*createmark elements 1 "all"
*numbersmark elements 1 0
*clearmark elems 1
*clearmark elems 2
*createmarkpanel elems 1 "Select elements"
set selected [hm_getmark elems 1]
*setoption force_text_black=1
*setoption element_color_mode=2
*numbersmark elements 1 1
foreach ID $selected {
     puts "Selected elements ID:   $ID"
     #select attached
     *createmark elems 1 $ID
     *findmark elems 1 1 1 elems 0 2
     puts "Attached elements IDs: [hm_getmark elems 2]"
     *numbersmark elements 2 1
}

Output:

Selected elements ID:   27
Attached elements IDs: 17 18 22 25 26 28 30 32
Selected elements ID:   47
Attached elements IDs: 37 38 45 46 48 85 87 95
Selected elements ID:   76
Attached elements IDs: 65 66 73 74 75 105 106 112

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading