I’m am attempting to query nested instance in rhino common and find it confusing.
If I have an InstanceReferenceGeometry, I see its Xform property and then it has a ParentIdefId.
I guess I look this up in the RhinoDoc.ActiveDoc.InstanceDefinition but using what method?
Will this look up give me InstanceDefinition objects or InstanceDefinitionGeometry objects?
How to you get the actual geometry objects from an InstanceDefinitionGeometry?
I start with a list of ObjRef
List geometries = GetListFromSomewhere();
foreach (var objref in geometries)
{
if (null != objref.Object())
{
var iref = objref.Object() as Rhino.DocObjects.InstanceObject;
if (iref != null)
{
Transform itransf = iref.InstanceXform;
var idef = iref.InstanceDefinition;
if (idef != null)
{
var inst_obj = idef.GetObjects();
foreach (Rhino.DocObjects.RhinoObject rhObj in inst_obj)
{
Rhino.Geometry.InstanceReferenceGeometry childRef = rhObj.Geometry as Rhino.Geometry.InstanceReferenceGeometry;
if(childRef != null)
{
// Stuck here
}
}
}