"None does not exist in GroupTable"

G’day Everyone,

Just a quick explanation before I leave work. Can add more details later if required.

The grouping script works fine the first time, but as I work to debug a second time the above error message appears and the script stops at rs.ObjectsByGroup. The previous group has been deleted, cannot purge any groups as there are none, cannot selGroup because there are none. But for some reason the group will not create or rename if the name has already been used.

Thoughts?

    group = rs.AddGroup()
    group = rs.RenameGroup(group, strName)

    groupObjects = rs.ObjectsByGroup(group, True)

regards,
Nick

Hi @Ncik,

If rs.RenameGroup fails, it will return None.

import rhinoscriptsyntax as rs
group = rs.AddGroup()
group = rs.RenameGroup(group, strName)
if group:
    groupObjects = rs.ObjectsByGroup(group, True)
else:
    print('Unable to rename group')

– Dale

G’day @dale,

But there are no groups. The one that was previously named “group” was deleted manually. SelGroup does not show any groups. Purge seems to have an effect now though. I don’t know why it didn’t previously. PEBCAK

Playing around some more it appears as though purge can find empty groups but selGroup does not show those.

As a work-around I will just delete the previously duplicate group name (rs.DeleteGroup). There should not be duplicates. Mmmm, maybe that’s not a great idea, perhaps I’ll just rename the new groups (+1) if it is a duplicate.