Hi GH Community!
I am hoping to get some help with a c# grasshopper script
-
I am trying to group some imported geometry using c#
-
I would also like to “remember” this imported group/geometry somehow so that it can be deleted on demand later on.
I have gotten this far with the c# script - I can’t seem to get the ObjectID from the list…
private void importGeo(string filePath){
// Import the geometry
RhinoDoc.ActiveDoc.Objects.UnselectAll();
string cmd = "!_-Import " + "\"" + filePath + "\"" + " _Enter";
Rhino.RhinoApp.RunScript(cmd, false);
// add selected geometries to a list
var selectedObjs = RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(false, false).ToList();
List<Guid> ids = new List<Guid>();
for(int i = 0; i < selectedObjs.Count; i++){
ids.Add(selectedObjs(i).ObjectId); // this line seems to be the issue!
}
var doc = RhinoDoc.ActiveDoc;
int index = doc.Groups.Add(ids);
doc.Views.Redraw();
}
Any help/direction would be greatly appreciated
Thank you!