Get GUID from geometry

OK, having a brain fart here…

Once I have “extracted” the geometry of an doc object from its GUID with something like obj=rs.coercebrep(objID), is it possible to do the reverse and find the ID to whom the geometry originally belonged? Or do I have to keep track of the GUID list index of the object?

Thx,
–Mitch

As far as I understand, the geometry objects are not aware of Rhino in any way. For that, they are ‘wrapped’ in a RhinoObject, which has also the object attributes that define how to draw the geometry. The RhinoObject also has the GUID.

So, rather than using coerebrep, you could use coercerhinoobject. This will get you the rhino object (holding the GUID) and its geometry:

rhObj = rs.coercerhinoobject(objID)
if rhObj is None: 
    return
guid = rhObj.Id
geom = rhObj.Geometry
1 Like

Ahh, brilliant! Well, I already worked around it in this case, but this is really good to know, thanks!

–Mitch