Model.hm_getclosestpointsbetweentwolines#

Model.hm_getclosestpointsbetweentwolines(line1, line2)#

Find the shortest distance between two lines and return line points corresponding to this distance.

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

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

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • closestPoint1 (numpy.ndarray) - The closest point on the first line

    • closestPoint2 (numpy.ndarray) - The closest point on the second line

Example#

Find closest points between lines with IDs 1 and 2#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_getclosestpointsbetweentwolines(
    line1=ent.Line(model, 1), line2=ent.Line(model, 2)
)

print("Closest point to line 1:", result.closestPoint1)
print("Closest point to line 2:", result.closestPoint2)