Make Curve Non Periodic


#1

Is there a way to access the MakeNonPeriodic command from Rhino inside grasshopper, in particular inside a c# component ? Besides baking the curve, invoking the rhino command and then getting the curve back?

Thanks!


(David Rutten) #2

I think this might be what MakeNonPeriodic does?

if (curve.IsPeriodic)
{
  NurbsCurve nurbsCurve = curve.ToNurbsCurve();
  nurbsCurve.Knots.InsertKnot(nurbsCurve.Domain.T0, nurbsCurve.Degree);
  nurbsCurve.Knots.InsertKnot(nurbsCurve.Domain.T1, nurbsCurve.Degree);
  curve = nurbsCurve;
}

(David Rutten) #3

Nope, it’s easier:

NurbsCurve nurbsCurve = curve.ToNurbsCurve();
if (nurbsCurve.IsPeriodic)
  nurbsCurve.Knots.ClampEnd(CurveEnd.Both);

#4

Perfect, thanks.