Access the RhinoDoc for an InstanceObject

I want to access the RhinoDoc of an inserted block to get its object table and then do FindByLayer and calculate their areas. The reason I want to access rhinodoc is that I cannot get the object in the block using the current document’s object table.

It seems that InstanceObject.Document return the current doc instead of the linked document for the instanceobject. Is there any way I can do that?

Also, is it possible to access any rhino file (without openning it) and get its object table for some calculations. The model we are maintaining is super big, and sometime we just need to get some data from it. It would be nice if we can avoid opening it or at least I can open an empty rhino.exe file and start from there.

I am in python.

UPDATE: The workaround I have now is to GetObjects() of the InstanceDefinition and walk through the whole list to get objects on certain layer. I am not sure whether this is the same process the FindByLayer undergoes, since it would potentially take a long time if the block has thousands of objects.

Thanks!!

Rhino only maintains a single document at a time. Linked blocks are read in as read-only objects when you open a file. So you can find the underlying geometry for linked blocks in the active document (too). To determine if an object is from a linked block or not, just check it’s IsReference property.