import Rhino as r
a=[i for i in F.Objects]
c=[i.Geometry for i in a]
for i in c:
if 'Instance' in str(i):
d=[i.Xform for i in il]
And this is the file that I want to read, that contains the Blocks.
If you open your file in Rhino and the run BlockManager, you’ll see that the file contains seven instance definitions. Four of the instance definitions are oddly nested. That is, the parent instance definition does not contain any objects other than a instance object. Basically you have some unnecessary nesting.
Instance definitions are always oriented about the world origin, and they have no transformation associated with them.
Instance objects are “instances” of an instance definition. Instance objects have no real geometry - that only reference the definition. They do have a transformation.
If you close the BlockManager and run SelAll, four instance objects will be selected. Are these the “objects” you are trying to import?
If so, then rather than iterating File3dm.AllInstanceDefinitions, you’ll need to iterate File3dm.Objects and look for objects of type InstanceObject. When found, determine it’s instance definition, get the definition’s geometry, make a copy, and transform the copied geometry using the instance object’s transformation.
The example digs out the instance definition geometry, and does so recursively.
The InstanceObject.Explode basically does what th Explode command does when you pick an instance reference. This is not recursive, so you can end up with additional instance references. Plus, this returns Rhino document objects, not geometry.