Model.hm_getcoordinatesfromnearestsurface#
- Model.hm_getcoordinatesfromnearestsurface(x, y, z, surfaceIDs)#
Finds the point on one of surfaces (specified by the list of surface IDs
surfaceIDs) closest to the point specified by coordinates x, y, z.- Parameters:
x (double) – The x coordinate.
y (double) – The y coordinate.
z (double) – The z coordinate.
surfaceIDs (hwIntList) – The list of surfaces’ IDs on which the point will be found.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:closestPoint (numpy.ndarray) - The x, y and z coordinates of the closest point
surface (Entity) - The surface on which the closest point is found - Entity Type:
Surface
Examples#
Find coordinates of the point on surface with ID 12 that is closest to the location specified byx=1,y=3,z=5#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getcoordinatesfromnearestsurface(x=1, y=3, z=5, surfaceIDs=[12]) print("Closest Point's Coordinates:", result.closestPoint) print("Surface on which the closest point is found:", result.surface.id)
On surfaces with IDs 12, 14, 15 find the point closest to global origin point (x=0,y=0,z=0)#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getcoordinatesfromnearestsurface(x=0, y=0, z=0, surfaceIDs=[12, 14, 15]) print("Closest Point's Coordinates:", result.closestPoint) print("Surface on which the closest point is found:", result.surface.id)
Create a node on surface with ID 10 , closest to the point specified byx=1,y=3,z=5#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_getcoordinatesfromnearestsurface(x=1, y=3, z=5, surfaceIDs=[10]) newNode = ent.Node(model) newNode.globalx = result.closestPoint[0] newNode.globaly = result.closestPoint[1] newNode.globalz = result.closestPoint[2]