nodes.txt

3.3 10 3
1.4 6 0
2.6 7 4
8.5 10 9
0.3 2 2
6.4 6 10
1.1 5 7
5.7 3 3
0.6 8 9
1.4 0 6

create_nodes.tcl

set script_path [ file dirname [ file normalize [ info script ] ] ]
cd $script_path
set myfile "nodes.txt"
set a [open $myfile]
set lines [split [read $a] "\n"]
close $a
foreach line $lines {
    eval *createnode $line
}
# Show node id and node coordinates 
*createmark nodes 1 "all"
foreach node_id [hm_getmark nodes 1] {
    set x [hm_getentityvalue nodes $node_id x 0]
    set y [hm_getentityvalue nodes $node_id y 0]
    set z [hm_getentityvalue nodes $node_id z 0]
    *tagcreate nodes $node_id [format "%d (%.1f %.1f %.1f)" $node_id $x $y $z] "P$node_id" 1
}
*window 0 0 0 0 0

Discover more from Tips and Hints for Aerospace Engineers

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

Continue reading