Hi there,
I am pretty sure I found answers to this question somewhere, but I cannot recalll where, so I will ask this question again…
Let’s say I am working with nested blocks and with a GetObject
I wanted to select one of the nested blocks (not necessarily in the first level of the block).
Then I would try something like this:
go.SetCommandPrompt("Select items");
go.SubObjectSelect = true;
go.GetMultiple(1, 0);
foreach (var obj in go.Objects())
{
string nestedBlock = null;
if (obj.InstanceDefinitionPart() != null)
{
Guid nestedId = obj.InstanceDefinitionPart().Id;
foreach (var item in doc.InstanceDefinitions)
{
if (item.GetObjectIds().Contains(nestedId))
{
nestedBlock = item.Name;
break;
}
}
}
}
Rhino.RhinoApp.WriteLine(nestedBlock);
This will only return the first level’s block to me, not the block the object is located in.
I fear this will not be possible in any other way, correct?
Would then an appropriate way be, to check if the selections point and to get all nested definitions in place and check if any object in there has a connection to this point that is 0?
Point3d pickPoint = obj.SelectionPoint();
Or would there be more elegant ways?
Thanks,
T.