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)
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.
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.
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.