How to create component/properties using TCL script?

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

Hello,

I am begineer to TCL scripting!

I want to create components with the name component_t0:5 to component_2.0 with 0.1 increment from 0.5 to 2.0 using for loop .

 

Can anyone help me in this?

 

Answers

  • tinh
    tinh Altair Community Member
    edited November 2018

    for {set i 5} {$i<=20} {incr i} {

        *collectorcreateonly comps comp_t[expr 0.1*$i] '' 11

    }

  • Jeffersondhv
    Jeffersondhv Altair Community Member
    edited November 2018

    When I create properties often I have some problems with the IDs. (on LS-Dyna profile)

    I get ID conflict even though the ID is unique in the model.

     

    What can I do to fix this?

     

    Thanks,

    Jefferson Vieira

  • tinh
    tinh Altair Community Member
    edited November 2018

    Please post the error here

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2018

    Try doing property operations using property name instead of IDs. 

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2018

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2018

    for {set i 5} {$i<=20} {incr i} {

        *collectorcreateonly comps comp_t[expr 0.1*$i] '' 11

    }

     

    Hello Sir,

     

    Thanks for your information.

    I have created properties using above code. But I want to update thickness value according to the pro/comp name

    Example:

    thickness_t2.1  #comp name

    thickness_t2.1. #prop name --- in this i want to update thickness according to the name i.e 2.1 and card image also(PSHELL) in the same loop.

     

    Can anyone help me in this?

    Thank you,

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited December 2018

    Hi, 

     

    You can use a logic similar to below:

     set str_compname 'thickness_t2.1' set thickness [string trimleft [lindex [split $str_compname _] end] t] set str_prop [hm_getvalue comps name=$str_compname dataname=property.name] *setvalue prop name=$str_prop  95=$thickness; #95 is thickness dataname in Nastran user profile

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2018

    Hi, 

     

    You can use a logic similar to below:

      set str_compname 'thickness_t2.1' set thickness [string trimleft [lindex [split $str_compname _] end] t] set str_prop [hm_getvalue comps name=$str_compname dataname=property.name] *setvalue prop name=$str_prop  95=$thickness; #95 is thickness dataname in Nastran user profile

     

    Thank you