[GhPython] Convert PolyCurve to GUID?

I can’t find a way to convert a polycurve into a guid. I want to use rs.SimplifyCurve() on a polycurve but the error says it couldn’t be converted to guid. Is it impossible to convert polylines to guids? Is there any way around this?

(rs.coerceguid(polycurve) returns NoneType: )

Hi @joshuaterranova01,

You cannot convert a curve to a GUID. But if you add the curve to the document, the newly added curve object will be assigned a GUID, which you can then reference from rhinoscriptsyntax.

If that’s too much, then just use Curve.Simplify.

– Dale

You probably don’t need to convert it, check this out instead:


Thank you for the help! I’ll try the Simplify. For future reference, how would I add a curve in a python script to my document, thus assigning it a GUID?

Hi @joshuaterranova01,

If you like using rhinoscriptsyntax, then you can use one of the many "rs.Add` functions.


Otherwise, just add it to the document’s object table using ObjectTable.AddCurve.

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc