Model.hm_findclosestpointonline#

Model.hm_findclosestpointonline(x, y, z, line, return_type=0)#

For a given point on a line, this function returns the closest other point on that same line:

xc yc zc dist

where xc, yc and zc are the coordinates of the point on the line closest to input point, and dist is the distance between the original and projected points.

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

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

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

  • line (Entity) – The object describing the line entity.

  • return_type (int) –

    0 - Returns xc, yc, xc and dist as described above. This is the default if not specified.

    1 - Returns xc, yc, xc and arclen, where arclen is the arc length parameter, normalized between 0 and 1, that indicates the position of the found point along the length of the line.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • pointCoordinates (numpy.ndarray)

    • distance (double)

Example#

Find the point closest to a point with coordinates ( 2676 , -737 , 605 ) and located on line with ID 7#
import hm
import hm.entities as ent

model = hm.Model()

_ , result = model.hm_findclosestpointonline(
  x=2676, y=-737, z=605, line=ent.Line(model, 7), return_type=0
)

print("pointCoordinates", result.pointCoordinates)
print("distance", result.distance)