I have a closed spline that is intersected by a circle. I want to open the closed spline by trimming out the section crossed by the circle. I am trying to use RhinoScript's **TrimCurve** method, but I am not having much success. Help!

With **TrimCurve**, if the input curve is closed, then the trimming interval should decrease.

For example:

Option Explicit Sub CircleTrimmer ' Local variable declarations Dim curve, circle, ccx, ccx_t(1), interval ' Select closed curve to split curve = Rhino.GetObject("Select closed curve to split", 4) If IsNull(curve) Then Exit Sub If Not Rhino.IsCurveClosed(curve) Then Exit Sub ' Select circle to split with circle = Rhino.GetObject("Select circle to split with", 4) If IsNull(circle) Then Exit Sub If Not Rhino.IsCircle(circle) Then Exit Sub ' Intersect the two curves ccx = Rhino.CurveCurveIntersection(curve, circle) If IsNull(ccx) Then Rhino.Print "Curve and circle do not intersect" Exit Sub End If ' Make sure there are only two intersection events If UBound(ccx) <> 1 Then Rhino.Print "Unable to split curve" Exit Sub End If ' Get two intersection parameters on the curve ccx_t(0) = ccx(0,5) ccx_t(1) = ccx(1,5) ' If the input curve is closed and the interval is decreasing, ' then the portion of the curve across the start and end of the ' curve is returned. If ccx_t(0) < ccx_t(1) Then interval = Array(ccx_t(1), ccx_t(0)) Else interval = Array(ccx_t(0), ccx_t(1)) End If ' Trim the curve Rhino.TrimCurve curve, interval End Sub

developer/scriptsamples/circletrimmer.txt ยท Last modified: 2016/02/04 by sandy