While using TCL commands, how can I get the minimum (maximum) ID of selected entities (elements)
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
Answers
-
I think I would just do an lsort then get the first one in the list.
0 -
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
0 -
Hypermesh User said:
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.
0 -
Ben Buchanan said:
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.
Yes, As you said hm_entityminid is also there.. please explore..
Regards,
Manoj M.
0 -
Hypermesh User said:
Dear Ben,
I am glad that you have learned new command from me.
For documentation please check below link.
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.
0 -
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
0 -
Hello Ulrich,
Please mark as a correct answer if it works correctly ;-)
Regards,
Manoj M
0