I’d like to ask the user for selecting 1 group (and one group only) of objects and then continue the script.
I guess I could ask the user to select 1 object which is part of a group and then find which objects are in the same group. But I like that, when you are accidentally selecting multiple groups, it shows you the options of which group you want to select and you don’t get that when asking for a single object.
Here is one example:
self.m_objects = 
def CustomGeometryFilter(self, rh_object, geometry, component_index):
if rh_object and rh_object.GroupCount > 0:
if self.CommandResult() != Rhino.Commands.Result.Success:
rh_object = go.Object(0).Object()
groups = rh_object.GetGroupList()
for group in groups:
rh_objects = rh_object.Document.Groups.GroupMembers(group)
for rh_obj in rh_objects:
go = GetOneGroup()
if go.CommandResult()== Rhino.Commands.Result.Success:
object_ids = go.GroupObjects()
for obj_id in object_ids:
Note, if you call
GetObject::GetMultiple, because you like the “choose one group” menu, then no way to stop picking without pressing .