Geometry from InstanceDefinitionGeometry in a FileIO.File3dm

Hello,
I am trying to get the geometry of a blockdefintion from an external 3dm-file.
When I try this, I get the Rhino.GeometryInstanceDefinition.Geometry…
I am stuck at the point where I can process the “content” of this geometry (curves, lines, surfaces, breps, …).

data =  Rhino.FileIO.File3dm.Read(path)
for n in data.AllInstanceDefinitions:
    sc.doc.InstanceDefinitions.Add(n.Name, "", Rhino.Geometry.Point3d(0,0,0), [n])

When I look at the documentation of the InstanceDefinitionGeometry I find everything like Name, etc… but I cannot get it’s content?
What am I missing?

Thanks,
T.

1 Like

I assume this one is the block definition itself…
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_InstanceObject.htm

And the contents seem to be accessible by this

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_InstanceDefinition_GetObjects.htm

@mikity_kogekoge
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_InstanceDefinitionGeometry.htm
But this one does not have a Property “.Geometry”…
What you describe is the InstanceDefinition, here I receive a InstanceDefinitionGeometry!

I think you can get the Ids by this.

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_InstanceDefinitionGeometry_GetObjectIds.htm

Then, search File3dm.Objects
https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_FileIO_File3dm_Objects.htm

by the Id.
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_FileIO_CommonComponentTable_1_FindId.htm

1 Like

@mikity_kogekoge that worked like a charm!
Thanks!