Restore Custom RhinoObject at document load time

Hi All,

I am trying to restore my custom Rhino Objects from the UserDictionary attached to each object upon loading a document (3dm file) but I’m having some problems. Specifically: when would be the right time to do this?

I have tried doing it in event handlers for the RhinoDoc.EndOpenDocument event and in the ReadDocument() method of my plug-in, but it seems not all object are present in the document ObjectTable at those times (this could be because I am working with several large meshes). So if anyone has some tips for going about this, let me know!

Cheers,

Lucas.

Yes, this is where you will want to restore any custom objects you’ve written.

Alright, but where do I find all RhinoObjects at this time? I have an example where 2 meshes are visible upon loading the 3dm file, and only those two meshes are found in the Document’s ObjectTable. All objects on layers that are hidden are not present in this table.

I am looking for a way to iterate over all objects that are alive in the document from inside the EndOpenDocument handler.

Lucas

Ok nevermind: I found the error. When iterating over doc.Objects using the standard iterator (foreach (RhinoObject rhobj in doc.Objects)) not all objects are returned. However, if I use doc.Objects.GetObjectList(ObjectEnumeratorSettings) with the correct filters applied, it does return all objects. This may be very useful to put in the documentation string of RhinoDoc.Objects.

Cheers,

Lucas.