about *createentity using problem

User: "shiucomp5"
Altair Community Member
Updated by shiucomp5
clear
set comp_list "comp1 comp2 comp3"
set count 10
 
foreach var_comp $comp_list {
*createentity comps name="$var_comp"
set comp_id [hm_entitymaxid comps 0]
eval "*setvalue comps id=$comp_id id={Components $count}"
incr $count
}

i want to edit comp's id when i creat comp,but it fail.

curly brackets cant read this $count

anyone can solve this problem

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "Carlos Flauzino_22279"
    Altair Community Member
    Updated by Carlos Flauzino_22279

    Hi Shiu Comp,

     I didn't understand your intention with this code, but I fixed it according to your question.

    image

    1° I made a loop, created a set for the name, and a component using that set.

    2° Created a mark on this component to know with which ID it was created.

    3° Using the ID that I stored in "comps_id", I updated it to match the current value of count, "i".

     

    I don't see much use for this since the ID will always be the match the one that would be created normally.

     

    Just an example:

    image

    Best regard,

    Flauzino, C.

    User: "shiucomp5"
    Altair Community Member
    OP
    Updated by shiucomp5

    Hi Shiu Comp,

     I didn't understand your intention with this code, but I fixed it according to your question.

    image

    1° I made a loop, created a set for the name, and a component using that set.

    2° Created a mark on this component to know with which ID it was created.

    3° Using the ID that I stored in "comps_id", I updated it to match the current value of count, "i".

     

    I don't see much use for this since the ID will always be the match the one that would be created normally.

     

    Just an example:

    image

    Best regard,

    Flauzino, C.

    Since I am a beginner and don't have a deep understanding of the commands, I modify based on the log generated by command1. What I originally wanted was to automatically create components and change their ID numbers.

    User: "shiucomp5"
    Altair Community Member
    OP
    Updated by shiucomp5

    Hi Shiu Comp,

     I didn't understand your intention with this code, but I fixed it according to your question.

    image

    1° I made a loop, created a set for the name, and a component using that set.

    2° Created a mark on this component to know with which ID it was created.

    3° Using the ID that I stored in "comps_id", I updated it to match the current value of count, "i".

     

    I don't see much use for this since the ID will always be the match the one that would be created normally.

     

    Just an example:

    image

    Best regard,

    Flauzino, C.

    "Sorry, something funny happened. I originally tested the following syntax, and it didn't work:

    *createentity comps id=40 name="component4"

    But now when I tested it again, it worked. I can now create a component and customize its ID at the same time."

    User: "Carlos Flauzino_22279"
    Altair Community Member
    Updated by Carlos Flauzino_22279

    Since I am a beginner and don't have a deep understanding of the commands, I modify based on the log generated by command1. What I originally wanted was to automatically create components and change their ID numbers.

    I started the same way, it's a good start!

    I recommend using this page from Altair: https://help.altair.com/hwdesktop/hwd/topics/chapter_heads/tcl_modify_commands.htm

    It helps a lot as well!