V5 Problem with RhinoCommon GetSubObjects

I’m getting this kind error with RhinoCommon on Rhino 5 too !
Just calling GetSubObjects() on an InstanceObject raises a DocumentControlledException.

Hi @Alexandre_Beaudet, can you well us more about what you are trying to an why? Perhaps we can suggest an alternative to this method.

– Dale

Hi @dale

I was trying to get the meshes contained in an instance definition.
However, I retrieve the instance definitions from document.Objects which are RhinoObjects.
I thought the method GetSubObjects would give me the meshes or subinstances if the object type was ObjectType.InstanceReference but the only object I received was an exception :confused:

I managed by casting the RhinoObject to an InstanceObject and then calling GetObjects on it. It works as expected now :ok_hand:

I’m curious though ; why would that method systematically throw an exception ? And what does that exception would mean ?

Thank you !

Because it is incorrectly written…

– Dale