Finds coordinates of a point that belongs to one of surfaces in input set and is a closest point to the location specified in command input.


hm_getcoordinatesfromnearestsurface x y z surf_id_list


HyperMesh Tcl Query Command


This command finds the point on one of surfaces (specified by the list of surface IDs surf_id_list) closest to the point specified by coordinates x, y, z. The command returns the result as a list of four values. The first, second and third value in the list specify the x, y and z coordinates of the closest point correspondingly. The fourth value in the list is the ID of the surface on which the closest point is found.


The x coordinate.
The y coordinate.
The z coordinate.
The ID of the surface on which the closest point is found.


To find coordinates of the point on surface 12 that is closest to the location specified by x=1, y=3, z=5:

hm_getcoordinatesfromnearestsurface 1 3 5 12

On surfaces with IDs 12, 14, 15 find the point closest to global origin point (x=0, y=0, z=0):

hm_getcoordinatesfromnearestsurface 0 0 0 [ list 12 14 15 ]

To create node on surface with ID 10, closest to the point specified by x=1, y=3, z=5:

set closest_pnt [ hm_getcoordinatesfromnearestsurface 1 3 5 10 ]
set x [ lindex $closest_pnt 0 ]
set y [ lindex $closest_pnt 1 ]
set z [ lindex $closest_pnt 2 ]
*createnode $x $y $z


Incorrect usage of hm_getcoordinatesfromnearestsurface results in a Tcl error. The function returns an error when the list of input surfaces (surf_id_list) is empty or some of IDs specified in surf_id_list does not belong to any surface in the model. To detect errors, you can use the Tcl catch command:

if { [ catch { hm_getcoordinatesfromnearestsurface $x $y $z $surf_list } ] } {
# Handle error here

Version History