Hello,
I’d like to know how to enum layers in selected group.
I’d like to enum all layers of all objects in group ( Group can have groups recursively ), even if But Only once.
Hello,
I’d like to know how to enum layers in selected group.
I’d like to enum all layers of all objects in group ( Group can have groups recursively ), even if But Only once.
Hi Katsu, i guess you´re still doing it in Python. Below script will print each group name followed by the layers the objects in the groups are on:
import rhinoscriptsyntax as rs
def LayersFromGroups():
obj_ids = rs.GetObjects("Pick grouped objs", 0, True)
if not obj_ids: return
# a set of group names
g_set = set()
# gets all groups once
for id in obj_ids:
[g_set.add(g) for g in rs.ObjectGroups(id)]
for group in g_set:
# get all objects in each group
objects = rs.ObjectsByGroup(group, False)
l_set = set()
[l_set.add(rs.ObjectLayer(obj)) for obj in objects]
print "GroupName: " + group
for l in l_set: print l
if __name__=="__main__":
LayersFromGroups()
c.