CurveSurfaceIntersection

Calculates the intersection of a curve object with a surface object. Note, this function works on the untrimmed portion of the surface.

Syntax

rhinoscriptsyntax.CurveSurfaceIntersection (curve_id, surface_id, tolerance=-1, angle_tolerance=-1)

rhinoscript.curve.CurveSurfaceIntersection (curve_id, surface_id, tolerance=-1, angle_tolerance=-1)

Parameters

curve_id

Required.  String or Guid.  The identifier of a curve object.

surface_id

Required.  String or Guid.  The identifier of a surface object.

tolerance

Optional.  Number.  The absolute tolerance in drawing units.  If omitted, the document's current absolute tolerance is used.

angle_tolerance

Optional.  Number.  The angle tolerance in degrees.  The angle tolerance is used to determine when the curve is tangent to the surface.  If omitted, the document's current angle tolerance is used.

Returns

List

A two-dimensional list of intersection information if successful.  The list will contain one or more of the following elements:

Element

Type

Description

[n][0]

Number

The intersection event type, either Point (1) or Overlap (2).

[n][1]

Point3d

If the event type is Point (1), then the intersection point on the curve.

If the event type is Overlap (2), then intersection start point on the curve.

[n][2]

 

Point3d

If the event type is Point (1), then the intersection point on the curve.

If the event type is Overlap (2), then intersection end point on the curve.

[n][3]

 

Point3d

If the event type is Point (1), then the intersection point on the surface.

If the event type is Overlap (2), then intersection start point on the surface.

[n][4]

 

Point3d

If the event type is Point (1), then the intersection point on the surface.

If the event type is Overlap (2), then intersection end point on the surface.

[n][5]

 

Number

If the event type is Point (1), then the curve parameter.

If the event type is Overlap (2), then the start value of the curve parameter range.

[n][6]

 

Number

If the event type is Point (1), then the curve parameter.

If the event type is Overlap (2),  then the end value of the curve parameter range.

[n][7]

 

Number

If the event type is Point (1), then the U surface parameter.

If the event type is Overlap (2), then the U surface parameter for curve at (n, 5).

[n][8]

 

Number

If the event type is Point (1), then the V surface parameter.

If the event type is Overlap (2), then the V surface parameter for curve at (n, 5).

[n][9]

 

Number

If the event type is Point (1), then the U surface parameter.

If the event type is Overlap (2), then the U surface parameter for curve at (n, 6).

[n][10]

 

Number

If the event type is Point (1), then the V surface parameter.

If the event type is Overlap (2), then the V surface parameter for curve at (n, 6).

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

def csx():

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

    if curve is None: return

    surface = rs.GetObject("Select surface", rs.filter.surface)

    if surface is None: return

    intersection_list = rs.CurveSurfaceIntersection(curve, surface)

    if intersection_list is None:

        print "Curve and surface do not intersect."

        return

    for intersection in intersection_list:

        if intersection[0]==1:

            print "Point"

            print "Intersection point on curve:", intersection[1]

            print "Intersection point on surface:", intersection[3]

            print "Curve parameter:", intersection[5]

            print "Surface parameter:", intersection[7], ",", intersection[8]

        else:

            print "Overlap"

            print "Intersection start point on curve:", intersection[1]

            print "Intersection end point on curve:", intersection[2]

            print "Intersection start point on surface:", intersection[3]

            print "Intersection end point on surface:", intersection[4]

            print "Curve parameter range:", intersection[5], "to", intersection[6]

            print "Surface parameter range:", intersection[7], ",", intersection[8], "to", intersection[9], ",", intersection[10]

csx()

Also See

CurveCurveIntersection

CurveBrepIntersect