🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

While using TCL commands, how can I get the minimum (maximum) ID of selected entities (elements)

User: "Ulrich W."
Altair Community Member
Updated by Ulrich W.

Hello, first please excuse if I post a question already answered earlier.

While programming a subroutine in TCL for automisation purpose, I need to get the minimum ID of elements (displayed, selected, or grouped) stored in a variable.

In further steps all attached elements to this element shall be moved to a new component in Hypermesh.

 

If any one could help and provide a solution I would be very glad.

Thank you in advance.

Ulrich

Find more posts tagged with

Sort by:
1 - 7 of 71
    User: "Ben Buchanan"
    Altair Employee
    Updated by Ben Buchanan

    I think I would just do an lsort then get the first one in the list.

    User: "Hypermesh User"
    Altair Community Member
    Updated by Hypermesh User

    Hi Ulrich,

     

    Please use the below code for your problem.

     

    eval *createmark elements 1 "displayed"
    set Maxeleid [hm_entitymaxid elements 1]

    eval *createmark elements 1 $Maxeleid
    *findmark elements 1 257 1 elements 0 2
    set adjele [hm_getmark elements 2]

    set countlst [llength $adjele]

    for {set i 0} {$i < $countlst} {incr i} {

    lappend Maxeleid [lindex $adjele $i]

    }

    *collectorcreateonly components "New_Collector" "" 11

    hm_createmark elems 1 $Maxeleid
    *movemark elements 1 "New_Collector"

     

    Please reply if you face any issues.

     

    Regards,

     

    Manoj M

    User: "Ben Buchanan"
    Altair Employee
    Updated by Ben Buchanan

    Hi Ulrich,

     

    Please use the below code for your problem.

     

    eval *createmark elements 1 "displayed"
    set Maxeleid [hm_entitymaxid elements 1]

    eval *createmark elements 1 $Maxeleid
    *findmark elements 1 257 1 elements 0 2
    set adjele [hm_getmark elements 2]

    set countlst [llength $adjele]

    for {set i 0} {$i < $countlst} {incr i} {

    lappend Maxeleid [lindex $adjele $i]

    }

    *collectorcreateonly components "New_Collector" "" 11

    hm_createmark elems 1 $Maxeleid
    *movemark elements 1 "New_Collector"

     

    Please reply if you face any issues.

     

    Regards,

     

    Manoj M

    Nice Manoj.  I didn't know about the hm_entitymaxid command. Looks like it is also not documented.

    Looks like there is an hm_entityminid command also.

    User: "Hypermesh User"
    Altair Community Member
    Updated by Hypermesh User

    Nice Manoj.  I didn't know about the hm_entitymaxid command. Looks like it is also not documented.

    Looks like there is an hm_entityminid command also.

    Dear Ben,

     

    I am glad that you have learned new command from me.

     

    For documentation please check below link.

     

    https://2020.help.altair.com/2020.1/hwdesktop/hwd/topics/reference/hm/hm_entitymaxid.htm?zoom_highlightsub=hm_entitymaxid

     

    Yes, As you said hm_entityminid is also there.. please explore..

     

    Regards,

     

    Manoj M.

    User: "Ben Buchanan"
    Altair Employee
    Updated by Ben Buchanan

    Dear Ben,

     

    I am glad that you have learned new command from me.

     

    For documentation please check below link.

     

    https://2020.help.altair.com/2020.1/hwdesktop/hwd/topics/reference/hm/hm_entitymaxid.htm?zoom_highlightsub=hm_entitymaxid

     

    Yes, As you said hm_entityminid is also there.. please explore..

     

    Regards,

     

    Manoj M.

    Thanks.  I searched for entitymaxid and it didn't come up.  When you search for hm_entitymaxid it does come up.

    User: "Ulrich W."
    Altair Community Member
    OP
    Updated by Ulrich W.

    Hello Manoj

     

    thank you very much for your help.

    I´ll include the commands into my procedure

    I´m sure they will work, if I had described my problem correctly.

    Regards

    Ulrich 

    User: "Hypermesh User"
    Altair Community Member
    Updated by Hypermesh User

    Hello Ulrich,

     

      Please mark as a correct answer if it works correctly ;-)

     

    Regards,

     

    Manoj M