ex403.tcl

1set script_path [ file dirname [ file normalize [ info script ] ] ]
2puts $script_path
3cd $script_path
4pwd
5*createmark elems 1 all
6set elemList [ hm_getmark elements 1 ]
7*clearmark elements 1
8set outfile [open "ex403.txt" w] 
9foreach elem_id $elemList {
10    # Get the list of node IDs corresponding to the element
11    set nodeIDs [hm_getvalue elements id=$elem_id dataname=nodes]
12    # Construct a list made of the element ID and its node IDs
13    set mylist [list $elem_id $nodeIDs]
14    puts $mylist
15    puts $outfile $mylist
16}
17close $outfile

Output file:
ex403.txt

12746 {3016 2892 2891 3012}
22745 {2958 2893 2892 3016}
32744 {3015 3016 3012 3011}
42743 {2957 2958 3016 3015}
52742 {3449 3015 3011 3445}
62741 {3391 2957 3015 3449}
72740 {3014 2890 2889 3004}
82739 {3012 2891 2890 3014}
92738 {3013 3014 3004 3003}
102737 {3011 3012 3014 3013}
112736 {3447 3013 3003 3437}
122735 {3445 3011 3013 3447}
13...

Discover more from Tips and Hints for Aerospace Engineers

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

Continue reading