Hi All,
Estoy tratando de encontrar una manera de contar los grupos, ya que cuando selecciono muchos grupos de curvas rhino me cuenta de todas las curvas, pero no todos los grupos que se encuentran seleccionados
Buscando que rhino aparesca algo como ej:
4 curvas seleccionadas dentro de un grupo
I’m trying to find a way to count the groups, because when I select many groups of rhino curves I noticed all the curves but not all groups.
Looking for something that rhino appears as an example:
4 selected curves within a group
Since each object can be in more than one group, what do you want as output if, using your example, you also had groups of circles, squares, pentagons, and ellipses, making a total of 7 groups for the 12 curves?
import rhinoscriptsyntax as rs
def main():
idObjs = rs.SelectedObjects()
if len(idObjs) == 0:
print "No objects are selected."
return
sGroups_AllSel = []; sGroups_SomeSel = []
for idObj in idObjs:
sGroups_Obj = rs.ObjectGroups(idObj)
if len(sGroups_Obj) > 0:
for g in sGroups_Obj:
if g in sGroups_AllSel or g in sGroups_SomeSel: continue
for idObj_Group in rs.ObjectsByGroup(g):
if not rs.IsObjectSelected(idObj_Group):
sGroups_SomeSel.append(g)
break
else: sGroups_AllSel.append(g)
print "Number of completely selected groups: {}".format(len(sGroups_AllSel))
print "Number of partially selected groups: {}".format(len(sGroups_SomeSel))
if __name__ == '__main__': main()