🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

RENAMING COMP COLLECTORS IN HYPERMESH using TCL scripts

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hi All,

 

Anyone can tell me the How to Rename the comp collectors in HyperMesh using TCL scripts.

 

For suppose Comp name : ABC12345_2.00T  and  PID : 1  OUTPUT : ABC12345_1

 

i want to keep that first eight digits, and i want to delete that thickness information and i want to rename with its PID

 

please tell me If anyone know

 

Regards,

Sudhakar

 

 

 

 

Find more posts tagged with

Sort by:
1 - 12 of 121
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Here is my not-yet-tested code:


    proc make_new_name { name } {
    # do some thing over current name to create new one
    return $newname;
    }
    *createmarkpanel components 1 'Select compo'
    set listComp [ hm_getmark components 1 0 ]
    foreach compID $listComp {
    set name [hm_entityinfo name components $compID]
    set newName [make_new_name $name]
    eval *renamecollector components $name $newName;
    }

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi

    below is a sample of 'make_new_name':


    proc make_new_name {name} {
    set i 1
    set _new_name [string range $name 0 [string last '_' $name]]
    set new_name ${_new_name}$i
    while {[hm_entityinfo exist comps $new_name]} {set new_name ${_new_name}[incr i]}
    set new_name
    }
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    hi  Q.NGUYEN-DAI,

     

    Thanks for your support.

     

    but i didn't get exactly '# do some thing over current name to create new one'

     

    what it means.

     

    Regards,

    Sudhakar

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hi Tinh,

     

    Thanks  for your support,

     

    But Above what you mentioned TCL code not running.

     

    Regards,

    Sudhakar

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    hi  Q.NGUYEN-DAI,

     

    Thanks for your support.

     

    but i didn't get exactly '# do some thing over current name to create new one'

     

    what it means.

     

    Regards,

    Sudhakar

     

    Do you have some programming skill with TCL ?

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Do you have some programming skill with TCL ?

     

    I have very basic Knowledge.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hi Tinh,

     

    Thanks  for your valuable support,

     

    using your TCL code i prepared tcl script to rename all the collectors.

     

    Thanks,

    Sudhakar Donepudi

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    hi Sudhakar,

     

    What changes you made to the script provided by Tinh?

     

    If possible can you paste the complete TCL script you used

    User: "tinh"
    Altair Community Member
    Updated by tinh

    hi Sudhakar,

     

    What changes you made to the script provided by Tinh?

     

    If possible can you paste the complete TCL script you used

    Hi, 

    you can use this function

    proc make_new_name {name} {set i 0set name_ [string range $name 0 [string last '_' $name]]while {[hm_entityinfo exist comps '${name_}[incr i]' -byname]} {}return ${name_}$i}
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

     

     

     

    Do you have some programming skill with TCL ?

    no i need to learn

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    How to rename the components by thicknesswise by using script? please help me out.

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    try this

    foreach compname [hm_entitylist comps name] {

         *renamecollector comps $compname $compname_[hm_getthickness [hm_getentityvalue comps $compname id 0 -byname]]

    }

     

     

    and above 'proc make_new_name' is unneccessary, use hm_getincrementalname instead.