Get an objects group membership

Hello,

i need to find out the group name an object belongs to. But i cannot find a function for it.
How can i achieve this?
Thanks in advance!

Greetings
Philip

Hi Philip- Rhino.ObjectGroups() in RhinoScript, Also implemented in Python/Rhinoscript Syntax. Does that help you?

-Pascal

Hello,

ObjectGroups(obj) will return all the groups that the object is a part of (as one object can be a member of several groups)

ObjectTopGroup(obj) will find the top-level group that an object is in (as one object can be in nested groups). This is apparent not yet implemented in Python, so it’s only in vb Rhinoscript.

ObjectsByGroup(group) will return all the objects in a particular group.

HTH,
–Mitch

1 Like

Thanks! I have overlooked that.

Hi Pascal,

You mention it’s also implemented in Python but when I try it out it doesn’t seem to work for me? In this script:

import Rhino

grouplist = []
for x in objcts:
group = Rhino.ObjectGroups(x)
grouplist.append(group)

I get an error saying “Message: attribute ‘ObjectGroups’ of ‘namespace#’ object is read-only”

Any idea?

Siemen

I found it.
I used rs.ObjectGroups(x)