Coerce Guid Failure in Python with Rhinoscript Syntax

rhinoscript
python

#1

Hi, I’ve come across a strange error regarding type hints which has been stopping me from being able to use certain rhinoscript syntax functions. I can create and manipulate geometry as usual, sometimes needing to change the type hint from guid to curve, etc. When I try to change the type hint back into a guid for use in another function, it fails and I the type check shows ‘NoneType’. Is there something I’m doing wrong or, otherwise, any way to retrieve a guid in this situation? Thanks!
Link to image of problem

Link to GH file: type hint.gh (2.7 KB)


(Giulio Piacentino) #3

Hi @drdru7029

Rhino.Geometry.Curve is the RhinoCommon class. By itself, it is an entity living in memory and has no Guid associated with it. When it is in a document, a Guid will be created and it will link to the Curve. However, the Curve still has no Guid. If you want, the Guid (with the document) together point to the Curve, not the other way around.

This means that, once the Guid is converted to a Curve, if you want a Guid, you’ll have to either find which Guid it originally had by keeping track on a side, or add a copy of it to the document and get a new Guid.

Does it help?

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com