Is there any way to get the objects (the geometries) in a group in Grasshopper without ungrouping them? I am grouping objects (geometries) for modeling purposes but now I need to get access to those objects (geometries) without modifying the group structure. Would really appreciate a solution.
Implementation not tested, code needs to be fixed depending on item/list/tree structure of “G” and “i” inputs…
Currently performance is trash as it exponentially waste resources as is the number of groups.
Code just as proof of concept:
private void RunScript(object G, int i, ref object O)
{
Grasshopper.Kernel.Data.IGH_Structure data = this.Component.Params.Input[0].VolatileData;
for(int j = 0; j < data.DataCount; j++){
Grasshopper.Kernel.Types.GH_GeometryGroup g = (Grasshopper.Kernel.Types.GH_GeometryGroup) data.get_Branch(0)[0];
O = g.Objects[i];
}
}