Make Curve Non Periodic

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!

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;
}

Nope, it’s easier:

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

Perfect, thanks.

Hi,
I cant really get my head around this.
sorry new to C#

Just add !! You output nothing

A = nurbsCurve;
1 Like
 private void RunScript(Curve curve, ref object A)
  {
    NurbsCurve nurbsCurve = curve.ToNurbsCurve();
    if (nurbsCurve.IsPeriodic)
      nurbsCurve.Knots.ClampEnd(CurveEnd.Both);
    A = nurbsCurve;
  }

You’re the best!