rs.ConvertCurveToPolyline() and rs.RebuildCurve() issues

I’ve been trying to make a small script that converts any closed curve to a polyline, exactly as in the ‘curve to polyline’ component or alternatively as in the ‘rebuild curve’ component (I would like to add this functionality to another script later).
When I use the rs.ConvertCurveCoPolyline() method however, the input parameters which say [opt] doesn’t seem to be optional. As you can see in the picture, the point count for the curve doesn’t change when I move the ‘tolerance slider’ from .5 to 10 which it clearly should have done. If I use the min/max Edge length it works better, but that’s not really what I would like to do here. What am I doing wrong here?

If I use rs.rebuildcurve instead, I get the error message: ‘Runtime error (ArgumentTypeException): expected Guid, got NurbsCurve,’ - how can I get the guid of a referenced curve parameter?


You can plug the referenced curve into a Guid parameter first, then plug the Guid parameter into the script.

Hi Jakob,

Check the rs.RebuildCurve doc string.

It says:

                      curve_id = identifier of the curve object

This means that you probably set your curve input type hint to “Curve”, instead of “ghdoc”.
Even though by default they require a guid input, some rhinoscriptsyntax methods will work with object inputs as well as with guid (identifier) inputs. This is what happened with ConvertCurveToPolyline function, and what caused the confusion.

Btw, it is always beneficial to attach your .gh file.
Problems like this can not be seen through screenshots.

1 Like