Deleted groups always listed

unhandled

#1

Hi @piac,

it looks like in V6, deleted groups are listed even when ignoreDeletedGroups = True.

I see this in the python script editor using:

scriptcontext.doc.Groups.GroupNames(True)

and in GH when i use:

Rhino.RhinoDoc.ActiveDoc.Groups.GroupNames(True)

Funny thing is if i iterate over the group names, get the index and query if they are deleted, they are not and their index is not -1.

Is this a bug or am i doing things wrong ?

_
c.


Is there a way to accesss groups-information in an object?
(Giulio Piacentino) #2

I am looking into this!


(Giulio Piacentino) #4

Hi @clement

so, it appears to be that the dialog does not show any group without members, because they cannot be selected. However, simply deleting members of a group will not delete the group.

To do what the dialog does, you can try this:

import scriptcontext as sc

def RhinoSelGroupsList():
    dialoglist = []
    for g in sc.doc.Groups:
        if g.Index < 0: continue
        members = sc.doc.Groups.GroupMembers(g.Index)
        if not members: continue
        dialoglist.append(g.Name)
    return dialoglist

print RhinoSelGroupsList()

In the meantime, I’ll ask if this is expected behavior.
I think this should be improved. I logged RH-44558.

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#5

Hi @piac,

i’ve noticed that too. Currently checking if there are group members seems to be the only way to get the non deleted groups. Is it expected that:

scriptcontext.doc.Groups.GroupNames(True)

lists group names of deleted groups ? I thought the True stands for ignoreDeletedGroups ? What really concerns me is that, if i use:

index = Rhino.RhinoDoc.ActiveDoc.Groups.Find(group_name, True)

in GH (RH6), it gives me an index value which is not -1, on deleted group names. So your above example to check for g.Index < 0 would not apply in the future ? (I used that very often).
_
c.


(Giulio Piacentino) #8

@clement, while @dale adds more comments indicating how groups deletion works, do you have a sample that works differently in V5 and in V6?

That way maybe we can help at least there!


#9

Thank you @piac, I’ve replied there.

Probably i’ve asumed similar like you that if a group is ungrouped or if objects in a group are deleted, the group is deleted as well.
_
c.