Rename all the entities in a model using TCL script.

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hello Friends,

 

I want to rename all the entities in a model with some prefix. 

 

For example:

Component Name: 51002134 to New Name: PSHELL_51002134

 

Can anyone please provide me a TCL script to do it.

 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited July 2015

    Hello Friends,

     

    I want to rename all the entities in a model with some prefix. 

     

    For example:

    Component Name: 51002134 to New Name: PSHELL_51002134

     

    Can anyone please provide me a TCL script to do it.

     

    Hello Friends,

     

    I want to rename all the entities in a model with some prefix. 

     

    For example:

    Component Name: 51002134 to New Name: PSHELL_51002134

     

    Can anyone please provide me a TCL script to do it.

     

    Hi,

    if you are using nastran or optistruct, try exporting model without 'HM comments' then import it again

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2015

    Try this code:


    *createmarkpanel comps 1 'Select Component to Rename'
    set my_comps [hm_getmark comps 1]

    foreach c $my_comps {
    set name [hm_getentityvalue comps $c name 1]
    set new_name [format 'PSHELL_%s' $name]
    eval *renamecollector components '$name' '$new_name'
    }

    *clearmark comps 1