#170 Gets the distance of the given point from the nearest line with IDs specified as arguments in HyperMesh tcl.
To get closest to the point with coordinates (10, 20, 30) point on the line with ID 13:
hm_getdistancefromnearestline [list 10 20 30] 13
To get closest line from the set with IDs 13 14 15:
hm_getdistancefromnearestline [list 10 20 30] [list 13 14 15]
To get closest to the node with ID 2 point on the line with ID 13:
hm_getdistancefromnearestline [hm_getvalue nodes id=2 dataname=coordinates] 13
This is an example, when we try to obtain closest line ID for the given point:
# consider node 71 set n 71 # get the coordinates of the node foreach {x y z} [join [hm_nodevalue $n]] {} puts "x=$x y=$y z=$z" # get all lines in the model *createmark lines 1 "all" set lines_list [hm_getmark lines 1] set results [hm_getdistancefromnearestline [list $x $y $z] $lines_list] set distance [lindex $results 0] set line_id [lindex $results 1] puts "min distance = $distance" puts "closest line ID = $line_id"
Output:
x=33.029 y=21.96 z=1.49 min distance = 3 closest line ID = 696
Recent Comments