hm_getcoordinatesfromnearestsurface
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.
Syntax
hm_getcoordinatesfromnearestsurface x y z surf_id_list
Type
HyperMesh Tcl Query Command
Description
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.
Inputs
- x
- The x coordinate.
- y
- The y coordinate.
- z
- The z coordinate.
- surf_id_list
- The ID of the surface on which the closest point is found.
Example
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
Errors
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
9.0