This Rhino script allows the user to select two curves to be connected, closing them into a single polyline, using either a rough equivalent of blend curve or straight connections… or not, it’s your call, give it a try you’ll see what I mean. It’s a great time saver for closing offset curves.
Rhino Script
Option Explicit 'Script written by <David Mans> 'Script copyrighted by <Neoarchaic Design> 'Script version Monday, September 01, 2008 6:39:25 AM Call Main() Sub Main() Call connectTwoCurves() End Sub Function connectTwoCurves() connectTwoCurves = Null Dim curve(1) curve(0) = Rhino.GetObject("Select Curve 1", 4) If isNull(curve(0)) Then Exit Function curve(1) = Rhino.GetObject("Select Curve 2", 4) If isNull(curve(1)) Then Exit Function Call Rhino.EnableRedraw(False) Dim dir Dim ptA(1),ptB(1),dist(1),cap(1) ptA(0) = Rhino.CurveStartPoint(curve(0)) ptA(1) = Rhino.CurveEndPoint(curve(0)) ptB(0) = Rhino.CurveStartPoint(curve(1)) ptB(1) = Rhino.CurveEndPoint(curve(1)) dist(0) = Rhino.Distance(ptA(0), ptB(0)) dist(1) = Rhino.Distance(ptA(0), ptB(1)) If dist(0) = dist(1) Then dir = True cap(0) = Rhino.AddLine(ptA(0), ptB(0)) cap(1) = Rhino.AddLine(ptA(1), ptB(1)) Else If dist(0) < dist(1) Then dir = True cap(0) = Rhino.AddLine(ptA(0), ptB(0)) cap(1) = Rhino.AddLine(ptA(1), ptB(1)) Else dir = False cap(0) = Rhino.AddLine(ptA(0), ptB(1)) cap(1) = Rhino.AddLine(ptA(1), ptB(0)) End If End If Call Rhino.EnableRedraw(True) Dim arrResults,arrInputs,arrValues arrInputs = array("Flip", "Yes", "No", "Type", "Smooth", "Straight", "Join", "Yes", "No") arrValues = array(True, True, False) arrResults = Rhino.GetBoolean("Connection Options", arrInputs, arrValues) Call Rhino.EnableRedraw(False) Dim tan(3),blend, ptC(3) If arrResults(1) = False Then Call Rhino.DeleteObjects(cap) blend = 0.25 tan(0) = Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorReverse(Rhino.CurveTangent(curve(0), Rhino.CurveDomain(curve(0))(0)))), Rhino.Distance(ptA(0), ptA(1)) * blend) tan(1) = Rhino.VectorScale(Rhino.VectorUnitize(Rhino.CurveTangent(curve(0), Rhino.CurveDomain(curve(0))(1))), Rhino.Distance(ptA(0), ptA(1)) * blend) tan(2) = Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorReverse(Rhino.CurveTangent(curve(1), Rhino.CurveDomain(curve(1))(0)))), Rhino.Distance(ptB(0), ptB(1)) * blend) tan(3) = Rhino.VectorScale(Rhino.VectorUnitize(Rhino.CurveTangent(curve(1), Rhino.CurveDomain(curve(1))(1))), Rhino.Distance(ptB(0), ptB(1)) * blend) ptC(0) = Rhino.PointAdd(Rhino.CurveStartPoint(curve(0)), tan(0)) ptC(1) = Rhino.PointAdd(Rhino.CurveEndPoint(curve(0)), tan(1)) ptC(2) = Rhino.PointAdd(Rhino.CurveStartPoint(curve(1)), tan(2)) ptC(3) = Rhino.PointAdd(Rhino.CurveEndPoint(curve(1)), tan(3)) If arrResults(0) = True Then If dir = False Then cap(0) = Rhino.AddCurve(array(ptA(0), ptC(0), ptC(3), ptB(1)), 3) cap(0) = Rhino.AddCurve(array(ptA(1), ptC(1), ptC(2), ptB(0)), 3) Else cap(0) = Rhino.AddCurve(array(ptA(0), ptC(0), ptC(2), ptB(0)), 3) cap(0) = Rhino.AddCurve(array(ptA(1), ptC(1), ptC(3), ptB(1)), 3) End If Else If dir = False Then cap(0) = Rhino.AddCurve(array(ptA(0), ptC(0), ptC(2), ptB(0)), 3) cap(0) = Rhino.AddCurve(array(ptA(1), ptC(1), ptC(3), ptB(1)), 3) Else cap(0) = Rhino.AddCurve(array(ptA(0), ptC(0), ptC(3), ptB(1)), 3) cap(0) = Rhino.AddCurve(array(ptA(1), ptC(1), ptC(2), ptB(0)), 3) End If End If Else If arrResults(0) = False Then Call Rhino.DeleteObjects(cap) If dir = False Then cap(0) = Rhino.AddLine(ptA(0), ptB(0)) cap(1) = Rhino.AddLine(ptA(1), ptB(1)) Else cap(0) = Rhino.AddLine(ptA(0), ptB(1)) cap(1) = Rhino.AddLine(ptA(1), ptB(0)) End If Else End If End If If arrResults(2) = False Then Call Rhino.JoinCurves(array(curve(0), cap(0), curve(1), cap(1)), True) End If Call Rhino.EnableRedraw(True) connectTwoCurves = array() End Function