Model.hm_getsurfaceuvatcoordinate#

Model.hm_getsurfaceuvatcoordinate(surface_entity, x, y, z)#

Returns the nearest surface u,v coordinate from a given x, y, z location.

The coordinate is projected to the nearest point on the input surface and returns its normalized u, v coordinates, the coordinates of the projected point and a string specifying the position of the projected point on the surface.

Parameters:
  • surface_entity (Entity) – The object describing the surface entity to query.

  • x (double) – The x coordinate of the point.

  • y (double) – The y coordinate of the point.

  • z (double) – The z coordinate of the point.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • uvCoordinates (numpy.ndarray) - The normalized u, v coordinates of the projected point on the surface

    • pointCoordinates (numpy.ndarray) - The coordinates of the projected point to the surface

    • projectionStatus (str) - The position of the projected point on the surface. Valid values are Point snapped to Edge, Point snapped to Edge End, Point snapped to Edge Start, Point snapped interior to the Surface, Point snapped to Vertex

Example#

Query the u , v coordinate of the point ( 1702.4653 , 403.6108 , 777.5562 ) projected on surface with ID 26#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_getsurfaceuvatcoordinate(
    surface_entity=ent.Surface(model, 26), x=1702.4653, y=403.6108, z=777.5562
)

print("UV Coordinates:", result.uvCoordinates)
print("Point Coordinates:", result.pointCoordinates)
print("Projection Status:", result.projectionStatus)