Get group of rhino to grasshopper

I would like to ask if there is any possibility to select groups of objects from rhino canvas and reference them in grasshopper?

In human @andheum plugin you can reference groups, but is there a way to select group by mouse and reference them? Would it work if I select GUID and group them by some sort of group identifier?

Maybe someone has similar example how to do this or a reference to Rhino SDK?

2780147107a69c4a60659996e5d1d16715be7a40

2 Likes

Found it:

  private void RunScript(List<Guid> Guids, object y, ref object A)
  {

DataTree<Guid> dtGrouped = new DataTree<Guid>();
DataTree<Guid> dtNotGrouped = new DataTree<Guid>();


int i = 0;
foreach(Guid g in Guids){
  var attributes = Rhino.RhinoDoc.ActiveDoc.Objects.Find(g).Attributes;
  int[] groupID = attributes.GetGroupList();
  if(groupID != null){
      dtGrouped.Add(g, new GH_Path(groupID[groupID.Length-1]));
  }else {
     dtNotGrouped.Add(g, new GH_Path(i));
  }
  i++;
}


A = dtNotGrouped;
B = dtGrouped;
}
3 Likes