I track many temporary object by object ID. In my plug-in, I regularly add and remove objects for temporary visualization or intermediate result display. Below is a rough outline of the process:
- Add object to document using CRhinoDoc::AddMeshObject(const ON_Mesh&)
- Do some calculations until a new intermediate result is available
- Lookup the old CRhinoObject using CRhinoDoc::LookupObject(ON_UUID)
- Remove the object from the document using CRhinoDoc::PurgeObject(CRhinoObject*)
In Rhino 5, LookupObject would return a non-const CRhinoObject. But in Rhino 6, the returned object is now const. I want to use PurgeObject so no delete record is created. I may be adding hundreds of temporary or intermediate mesh objects during calculations, none of which require an undo record.
Is it possible to retrieve a non-const CRhinoObject from the document in Rhino 6? If not, is there a quick alternative way to purge an object from the document without creating an undo record?