Rebuild polyline with rhinoscriptsyntax (GhPython)

Hello,
I am trying to convert a polyline into a NURBS curve by specifying a certain degree and a number of control points. rs.rebuildcurve outputs Boolean value but does not return the geometry. rs.fitcurve outputs “none”

Perhaps I am using an inappropriate way/commands to do it? Could you please point me what command I should use to get the same result as I am getting with the Native Rebuild Curve component in Grasshopper 3D.
discourse-rebuild-polyline-rhinoscriptsyntax.gh (7.4 KB)


Thank you

I found a way around:

pts = rs.DivideCurve(curve, control_pt)
rebuild_crv1 = rs.AddInterpCurve(pts)

Maybe not the most accurate way, but it works so far.

Ilja

in loose python terms, the Curve is a mutable object so the RebuildCurve already does the work when you call it.
your code should probably look like this

rs.RebuildCurve(curve, degree, control_pt)
rebuild_crv1 = curve
1 Like

@Will_Wang thank you. So we don’t need to assign a variable for the curve rebuild operation