Model.hm_getclosestpointsbetweenlinesurface#

Model.hm_getclosestpointsbetweenlinesurface(line, surf)#

Find the shortest distance between a line and a surface, and return line and surface points corresponding to this distance.

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

  • surf (Entity) – The object describing the surface entity.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for case which line and surf intersect

      • intersectionPoints (numpy.ndarray)

    • Keys valid for case which line and surf do not intersect

      • surfacePoint (numpy.ndarray)

      • linePoint (numpy.ndarray)

      • dist (double)

Examples#

Find the closest points between a line with ID 1 and a surface with ID 2 which intersect#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_getclosestpointsbetweenlinesurface(
    line=ent.Line(model, 1), surf=ent.Surface(model, 2)
)

print("Intersection points coordinates:", result.intersectionPoints)
Find the closest points between a line with ID 1 and a surface with ID 2 which do not intersect#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_getclosestpointsbetweenlinesurface(
    line=ent.Line(model, 1), surf=ent.Surface(model, 2)
)

print("Surface point:", result.surfacePoint)
print("Line point:", result.linePoint)
print("Distance:", result.dist)