Seepd up GroupTable.Delete()


I need to purge many groups from the group table ( about 2k empty groups).
This takes many minutes as I did not find another way than to iterate over the group indices to delete and pass them one by one to GroupTable.Delete(int)

I do it in python like so:

    for i in group_indices:

Is there another way to speed this up, maybe an overload to pass an array of indices?


Hi @Willem, i wonder if _Purge with only Groups=Yes is any faster when scripted ?


Hi Clement,

That was the reason I started coding it, the scripted command took ages as well.
I suspected the command to maybe use GroupTable.GroupMembers() making it inefficient by probing all objects for each query.

For now I will probably leave the purging as the time it takes does not outweigh the benefits.


Hi @Willem,

When you call GroupTable.Delete, Rhino iterates the object table looking for objects that are members and, if found, removes their membership before marking the group as deleted. Thus, a model with 2k groups and a fair amount of objects will take time, as that’s a lot of iterating.

– Dale

Hi Dale
Thanks for confirming my expectation.

I was thinking how about if I first collect all current objects’ groups. Next run GroupTable.Clear()
And recreate or undelete the groups that were filled.

However the more I think about it the more I realize my desire to purge the groups is mostly aesthetical.


Hi @Willem and @dale,

i wasn’t even aware of a GroupTable.Clear() method, it does not show in the left column where i usually look for method names.

@dale, there is a copy paste error, eg. replace LineType with Group. (link)