How to rename all component name (which are starting with number currently) starting with alphabet (Lets say A_)?

Unknown
edited October 2022 in Community Q&A

For Abaqus profile, if the component name starts with a numeric character, it return the Syntax error. Hence, for Abaqus jobs, all the component names should start from Alphabet.

 

Currently all my component name starts from number. And those are hundreds in number. It is very tedious task to rename one by one by adding A_ (lets say) in front of each component name.

 

So my request is how to add A_ in front of all the component names?

Answers

  • PaulAltair
    PaulAltair
    Altair Employee
    edited September 2022

    I adapted this tool from somewhere, a long while back? It has multiple find/replace capability, including a 1 click option to sort out all special characters or spaces, it doesn't have the specific option to add a prefix, but depending on your names, you may be able to workaround it as below, if this doesn't do what you need, maybe I could revisit it and add prefix as an option... load the tcl in HW/HM to use it

    image

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited September 2022

    For your simple case I think copying the following in a file and running it or running the following in the tcl console should work.

    hm_createmark comps 1 "advanced" "all"

    foreach compID [hm_getmark comps 1] {

        set compName [hm_getvalue comps id=$compID dataname=name]

        *setvalue comps id=$compID name="A$compName"

    }

  • Jason_Craanen
    Jason_Craanen
    Altair Employee
    edited October 2022

    For your simple case I think copying the following in a file and running it or running the following in the tcl console should work.

    hm_createmark comps 1 "advanced" "all"

    foreach compID [hm_getmark comps 1] {

        set compName [hm_getvalue comps id=$compID dataname=name]

        *setvalue comps id=$compID name="A$compName"

    }

    there is also this in-core tool you can find through the search
    image

     

  • Jason_Craanen
    Jason_Craanen
    Altair Employee
    edited October 2022

    You may want to try the Matrix Browser which allows you to make changes in Excel and push back to Hypermesh

    image