Connect Curves

Is there a something similar to the “Connect” function in Rhino python? I tried adding a 0mm fillet but I realised that won’t work using python.

Cheers

Hi @Alasdair, below seems to work:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    rc0 = rs.GetCurveObject("Pick first open curve near end", False, False)
    if not rc0: return
    
    rc1 = rs.GetCurveObject("Pick second open curve near end", False, False)
    if not rc1: return
    
    c0 = rs.coercecurve(rc0[0], -1, True)
    c1 = rs.coercecurve(rc1[0], -1, True)
    
    p0, p1 = rc0[3], rc1[3]
    
    t = scriptcontext.doc.ModelAbsoluteTolerance
    a = scriptcontext.doc.ModelAngleToleranceDegrees
    
    rc = Rhino.Geometry.Curve.CreateFilletCurves(c0, p0, c1, p1, 0, True, True, True, t, a)
    if rc.Count != 0:
        for crv in rc: scriptcontext.doc.Objects.AddCurve(crv)
        scriptcontext.doc.Objects.Delete(rc0[0], False)
        scriptcontext.doc.Objects.Delete(rc1[0], False)
        scriptcontext.doc.Views.Redraw()
    
DoSomething()

There is more info to the method here.

_
c.

Thanks thats really helpful!

Another method I thought of that isn’t as robust:

import rhinoscriptsyntax as rs

curve01 = rs.GetObject()
curve02 = rs.GetObject()

rs.EnableRedraw(False)

point = rs.LineLineIntersection(curve01, curve02)
point = rs.AddPoint(point[0])

extensionBoundary = rs.AddLine(point, [0,0,0])

rs.ExtendCurve(curve01, 0, 2, [extensionBoundary])
rs.ExtendCurve(curve02, 0, 2, [extensionBoundary])

rs.DeleteObject(extensionBoundary)
rs.DeleteObject(point)

rs.EnableRedraw(True)