ex403.tcl

set script_path [ file dirname [ file normalize [ info script ] ] ]
puts $script_path
cd $script_path
pwd
*createmark elems 1 all
set elemList [ hm_getmark elements 1 ]
*clearmark elements 1
set outfile [open "ex403.txt" w]  
foreach elem_id $elemList {
    # Get the list of node IDs corresponding to the element
    set nodeIDs [hm_getvalue elements id=$elem_id dataname=nodes]
    # Construct a list made of the element ID and its node IDs
    set mylist [list $elem_id $nodeIDs]
    puts $mylist
    puts $outfile $mylist
}
close $outfile

Output file:
ex403.txt

2746 {3016 2892 2891 3012}
2745 {2958 2893 2892 3016}
2744 {3015 3016 3012 3011}
2743 {2957 2958 3016 3015}
2742 {3449 3015 3011 3445}
2741 {3391 2957 3015 3449}
2740 {3014 2890 2889 3004}
2739 {3012 2891 2890 3014}
2738 {3013 3014 3004 3003}
2737 {3011 3012 3014 3013}
2736 {3447 3013 3003 3437}
2735 {3445 3011 3013 3447}
...

Discover more from Tips and Hints for Aerospace Engineers

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

Continue reading