Changing the ID

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

Hey guys,

 

I want to create several materials, properties and components automatically.

The desired IDs of all the materials, properties and components are saved in an external file and then written into a variable. Each of these values should create an own material, an own property and an own component. 

For creating the first material, everything works fine. But when the second material should be created, an error is occurring.

Do you have an idea how this problem can be fixed?

 

Kind regards

Simon

 

Attached, you can find the file with the IDs (these are the values in column 1 saved into the variable 'field1') and the .tcl-script I'm talking about.

 

 

Unable to find an attachment - read this blog

Answers

  • sandeepballiwar
    sandeepballiwar New Altair Community Member
    edited February 2019

    below code  should work. 

     

    # Erstellen des Materials                
    *createentity mats cardimage=MAT1 name=material1;
    set matid [hm_latestentityid mats]
    *setvalue mats id=$matid name='$field1'; #E Value
    *setvalue mats id=$matid STATUS=1 1=$field2
    *setvalue mats id=$matid STATUS=1 3=0.3
    *setvalue mats id=$matid STATUS=1 4=7.85e-009
    *createmark materials 1 '$field1'
    *renumbersolverid materials 1 $field1 1 0 0 0 0 0

     

    *createentity props cardimage=PSHELL name=property1;
    set propid [hm_latestentityid props]

    *setvalue props id=$propid name=$field1
    *createmark properties 1 '$field1'
    *renumbersolverid properties 1 $field1 1 0 0 0 0 0
    *setvalue props id=$propid materialid={mats $field1}

     

    # Zuweisen zum Element mit der ID
    *createentity comps name=component1;
    set compsid [hm_latestentityid comps]
    *setvalue comps id=$compsid name='$field1'
    *setvalue comps id=$compsid id={comps $field1}
    *setvalue comps id=$field1 propertyid=$propid

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited February 2019

    @Bachelor22: Not need use following code in your script:

     

    *startnotehistorystate 

    *endnotehistorystate