Recreating custom object after reopening

Hi @dale

You mentioned how to recreate custom objects after rhino opened a document here, it works fine with regular visible objects, but for hidden objects are not included in e.Document.Objects in follosing RhinoDoc_EndOpenDocument.

So my questions is what is the best way to get all rhino objects after Rhino opens a documents, so that I can find all custom objects and recreate them again?

Thanks in advance.
Mingbo

        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            RhinoDoc.EndOpenDocument += RhinoDoc_EndOpenDocument;
            return LoadReturnCode.Success;
        }

        private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e)
        {
            RhinoDoc doc = e.Document;

            // doc.Objects doesn't include all objects. I found hidden objects are not listed here.

        }

I think I have found a solution for this case:
doc.Objects.GetObjectList() is able to get all objects with settings.

            var setting = new ObjectEnumeratorSettings();
            setting.HiddenObjects = true;
            setting.LockedObjects = true;
            setting.NormalObjects = true;

            var objs = doc.Objects.GetObjectList(setting);
2 Likes