CurveMeshIntersection

Calculates the intersection of a curve object and a mesh object.

Syntax

rhinoscriptsyntax.CurveMeshIntersection (curve_id, mesh_id, return_faces=False)

rhinoscript.mesh.CurveMeshIntersection (curve_id, mesh_id, return_faces=False)

Parameters

curve_id

Required.  String or Guid.  The identifier of the curve to intersect.

mesh_id

Required.  String or Guid.  The identifier of the mesh to intersect.

return_faces

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

Returns

List

If return_faces is either omitted or False, then a list of intersection points, if successful.

List

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

Element

Type

Description

0

Point3d

The 3-D intersection point.

1

Number

The mesh face index on which the intersection point lies.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

curve = rs.GetObject("Select curve to intersect", rs.filter.curve)

if curve:

    mesh = rs.GetObject("Select mesh to intersect", rs.filter.mesh)

    if mesh:

        cmx = rs.CurveMeshIntersection(curve, mesh, True)

        if cmx:

            for element in cmx:

                print element[0], ", Face index = ", element[1]

                rs.AddPoint(element[0])

Also See

MeshClosestPoint

MeshMeshIntersection