LineMeshIntersection

Intersect an infinite line and a mesh object.

Syntax

Rhino.LineMeshIntersection (arrLine, strMesh [, blnReturnFaces])

Parameters

arrLine

Required.  Array.  Two 3-D points identifying the starting and ending points of the line.

strMesh

Required.  String.  The identifier of the mesh object.

blnReturnFaces

Optional.  Boolean.  Return both intersection points and face indices.  If omitted or False, then just the intersection points are returned.

Returns

Array

If blnReturnFaces is either omitted or False, then an array intersection points, if successful.

Array

If blnReturnFaces is True, then a one-dimensional array containing information about each intersection if successful.  Each array element is a one-dimensional array that contains the following two elements:

Element

Type

Description

0

Array

The 3-D intersection point.

1

Number

The mesh face index on which the intersection point lies.

Null

If not successful, or on error.

Example

Sub TestLineMeshIntersection

  Dim strMesh, arrStart, arrEnd, arrLMX, arrPt

  strMesh = Rhino.GetObject("Select mesh", 32)

  If IsNull(strMesh) Then Exit Sub

  arrStart = Rhino.GetPoint("Start of line")

  If IsNull(arrStart) Then Exit Sub

  arrEnd = Rhino.GetPoint("End of line", arrStart)

  If IsNull(arrEnd) Then Exit Sub

  arrLMX = Rhino.LineMeshIntersection(Array(arrStart, arrEnd), strMesh, False)

  If IsArray(arrLMX) Then

    For Each arrPt in arrLMX

      Rhino.AddPoint arrPt

    Next

  End If

End Sub

Also See

LineArcIntersection

LineBoxIntersection

LineCircleIntersection

LineCurveIntersection

LineCylinderIntersection

LineLineIntersection

LinePlaneIntersection

LineSphereIntersection