How to Create SPRING property through TCL script?

Akshay Manthekar
Akshay Manthekar Altair Community Member
edited July 2023 in Community Q&A

Hi All,

I have created various SPRINGA and SPRING2 elements in my model. Now I want to create a property for those spring elements through TCL script. 

Can anyone help me with writing the code/ creating method which would create the SPRING property in HyperMesh?

Thanks and Regards,

Akshay Manthekar

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited July 2023

    hi @Akshay Manthekar 

     

    The process in creating a TCL script in general is to perform the operation manually in HM a few times, and then check the 'command.tcl' file to check what are the major commands/APIs used.

    these videos looks nice:

    https://www.youtube.com/watch?v=fxv43oRyzdo

  • Akshay Manthekar
    Akshay Manthekar Altair Community Member
    edited July 2023

    Hey Adriano,

    Thanks for the reply. Actually, I have already tried checking commands from "commands.tcl" file for property update. But I am unable to understand the syntax of those commands. 

    For eg. I want to create a property called "AXIAL_SPR" with cardimage = "SPRING" and type as "LINE SECTION" with stiffness = 123456. (I am using HyperMesh Desktop 2017.3) See image below:

    imageimage

    In the command.tcl file, code being generated as follows:

    image

    In the above code, I am unable to understand the numbers (139,4701,4397,etc). Unable to figure out which no corresponds to what. 

    On the other hand, I have learned that *setvalue is used to update/modify entity with new data. But it is not being shown in command.tcl file

    I would really appreciate if you could help me create "AXIAL_SPR" property and modify its attributes using *setvalue command. Documentation for *setvalue is also not helping me out.

    Thanks and Regards,

    Akshay Manthekar

     

     

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited July 2023

    Hey Adriano,

    Thanks for the reply. Actually, I have already tried checking commands from "commands.tcl" file for property update. But I am unable to understand the syntax of those commands. 

    For eg. I want to create a property called "AXIAL_SPR" with cardimage = "SPRING" and type as "LINE SECTION" with stiffness = 123456. (I am using HyperMesh Desktop 2017.3) See image below:

    imageimage

    In the command.tcl file, code being generated as follows:

    image

    In the above code, I am unable to understand the numbers (139,4701,4397,etc). Unable to figure out which no corresponds to what. 

    On the other hand, I have learned that *setvalue is used to update/modify entity with new data. But it is not being shown in command.tcl file

    I would really appreciate if you could help me create "AXIAL_SPR" property and modify its attributes using *setvalue command. Documentation for *setvalue is also not helping me out.

    Thanks and Regards,

    Akshay Manthekar

     

     

    these strange numbers are the internal codes for each filed on the property.

    each one represents a value in your property. In example, the dataname '483' is related to your stiffness.

    I know it is confusing, so the way I usually do, is to create at least 2 or 3 different properties manually, first, assigning values easy to locate, as in example stiffness=1111.1 for the first prop, then 2222.2 for the second one, and 3333.3 for the third one.

    Then, if i open the command .tcl, I can easily spot the differences between each step, and understand what field should I change.

    If you want to understand exactly what field is related to each internal ID, then you could run this script provided in the installation folder: C:\Program Files\Altair\2021.2\hwdesktop\hm\examples\scripts\entity_attribute_table.tcl

    It will launch a new tab, and if you select some entity i.e property, you will see the entity name and internal ID, and values associated. Each solver has their own solver codes.

    image