import Rhino.Geometry as rg
if boundry.Contains(curve.PointAtStart) == rg.PointContainment.Inside and boundry.Contains(curve.PointAtEnd) == rg.PointContainment.Inside:
a = curve.Extend(rg.CurveEnd.Both, rg.CurveExtensionStyle.Line, [boundry])
ExtendCurve.gh (3.3 KB)