Use Comment Entries for renaming

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

Hi everybody,

I need to use Comment Entries form Component-Cards to do a rename of Components.

Solver Template is Nastran.

It works fine so far with PSOLIDs but doesn't with PSHELLs .

I tried to get the information of the comments, but using :

hm_attributeindexarraylength comps $comp1 6 -byid (6 is the index) doesn´t work fine.

There are Comps with the information in index 6, some in 7 others in 5 or 8 or even higher!

Is there no fix definition ?

Does anyone know a more direct way to get these infos in HM8.0SR1 (all SA-Updates installed)?

Bye,

Florian

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2007

    try using the hwat command ::hwat::utils::RenameEntity ...to review how its usage, review the altair tools help...

    you may need to add a path to the hwat libraries, use the following code

    	set tclDir [hm_info -appinfo SPECIFIEDPATH hw_tcl_common]	set hwatDir [file join $tclDir 'hwat']	lappend auto_path $hwatDir	package require hwat
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2007

    Hi Cesar,

    Sorry! I wrote wrong hm_ command in my question! Must of course be: ...value

    hm_attributeindexarraylength --> hm_attributeindexarrayvalue

    Renaming by Macro is no problem. My problem is to read out the comment-information.

    Example: A component is named by import of Nastran-Deck -> PSHELL_13013

    it has the comment info (CAD-Part-name, Mat & Thickness)

    -> 123456_C1A_Test-Part (1st comment line)

    -> DX54C 4.5 (2nd comment line)

    Target is to rename PSHELL_13013 --> P13013;123456_C1A_Test-Part_DX54C_4x5mm

    As I wrote, I know a way to get these infos, by :

    hm_attributeindexarrayvalue comps CompID indexID -byid

    but there seems to be no definition which indexID is reseverd for comment-lines.

    Do you or anyone else know a (mybe unsupported) command to get the comment lines as string values?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2007

    try using less characters, I counted 39 characters, try using up to 32. I would avoid using ';' in the collector name, I would use '_' instead.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2007

    You can also use the hm_attribute.... commands with the name of the values you want to get. It takes a bit of digging in the template to get the names - in the include directory for the nastran template is components.tpl. The comments are in COMMENT_ARRAY, COMMENT_ARRAY_NUM stores the number of lines.

    try:

    set comment_text_line1 [hm_attributearrayvalue COMPS 'PSHELL_13013' '$COMMENT_ARRAY' 1]

    and repeat for each line of comment info you want to use, up to the value of COMMENT_ARRAY_NUM. Then you can use the string manipulation commands to combine all the string variables into the new string name you want to use.