Hi all!
I’m trying to select grips of a specific SubD, one by one (to retain order).
Not grips of other objects.
Not more than one at once at time.
Problems:
custom filter.gh (23.1 KB)
Code for the top one:
void SelectMultipleGrips(GH_Document doc){
Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
go.GeometryFilter = Rhino.DocObjects.ObjectType.Grip;
go.SetCustomGeometryFilter(IsGripOwnedByGuid);
go.SetCommandPrompt("Select grips");
go.SubObjectSelect = false; //If you remove this row, IsGripOwnedByGuid filter won't work.
go.OneByOnePostSelect = true;
go.ChooseOneQuestion = true;
go.GetMultiple(1, 0);
objs = go.Objects();
this.Component.ExpireSolution(true);
}
static System.Guid SubDId = new System.Guid();
static bool IsGripOwnedByGuid(Rhino.DocObjects.RhinoObject obj, GeometryBase geo, ComponentIndex index){
return ((Rhino.DocObjects.GripObject) obj).OwnerId.Equals(SubDId);
}
Code for the bottom one:
void SelectMultipleGrips(GH_Document doc){
Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
go.SetCustomGeometryFilter(NOTHING);
go.GetMultiple(1, 0);
objs = go.Objects();
this.Component.ExpireSolution(true);
}
static bool NOTHING(Rhino.DocObjects.RhinoObject obj, GeometryBase geo, ComponentIndex index){
return false;
}
8 posts - 3 participants