rs.GetObject - limit to selecting within a specific collection of objects?

GetObjects has an optional ‘objects’ argument that allows selection only within a predetermined set of objects. Is there a reason that GetObject() does not have the same option?

Hi Mitch,

not sure if this is helpful to you but if you could set maximum_count of GetObjects() to 1, you have the same functionality as GetObject() with the abillity to define objects and limit to grouped objects. But you would set group=False and have this grp_filter:

def grp_filter(rhino_object, geometry, component_index):
    # only allow objects in groups
    return rhino_object.Attributes.GroupCount > 0

The result is then the first (single) object in the returned list:

obj_ids = rs.GetObjects("Select", 0, False, False, False, None, 1, 1, grp_filter)

Instead of None you would pass your obj ids to limit selection to. Is this what you’re trying to do ?

Hi Clement,

Thanks, this was more of a request to add that optional argument to GetObject(). I think the word ‘group’ in my title was confusing, I’ll change that…

Yes, the workaround is using GetObjects(), it’s actually a bit simpler than your example, basically just limit the selection count to minimum/maximum 1 object, plus passing the list of objects to select from in the ‘objects’ argument.

obj_ids = rs.GetObjects("Select", 0, False, True, False, [obj_coll], 1, 1)