I feel like this is an immensely stupid question, but I’m simply not able to get it done. I need to delete an object from the scene, and Rhino.RhinoDoc.ActiveDoc.Objects.Delete only accepts a GUID, not a RhinoCommon object. However, I simply cannot find anywhere how I am supposed to obtain the GUID from a RhinoCommon object. It has to be incredibly easy, but I simply can’t get it done.
If you have a grip on a Rhino object, have you tried to read the Id property?
How exactly would I grip my object?
Rhino.DocObjects.GripObject(curve) Doesn’t work
Ah I get it now! I made a mistake in my variable assignments, which meant that a not-yet-made RhinoCommon object shared it’s variable name with a GUID object in the scene. This is the reason I wasn’t able to remove it and also why it gave me the RhinoObject not a GUID error. Your link gave me the insight I needed, because it told me that object obtain a guid once added to the scene. Which is incredibly obvious, because it wouldn’t be a GUID if it wasn’t visible in the GUI
I’m still new to this
The following example should help you out when you don’t have a reference to the object yet:
The samples pages is gold
I’ll make sure to add this to my reference, I’ve mostly been searching both API’s
Yep, as you found out, you don’t actually need to delete anything that has not been added to the document, as it is just a virtual construction in memory. If you don’t do anything with it, the memory it takes up is simply reclaimed by the “garbage collector” after the script ends.