Dunno, AddGroup() is supposed to return the group name. Both of these work here:
import rhinoscriptsyntax as rs
group = rs.AddGroup("MyGroup")
print group
>>>MyGroup
Option Explicit
Call Test()
Sub Test()
Dim group
group = Rhino.AddGroup("MyGroup")
Rhino.Print(group)
End Sub
>>>MyGroup
Both vb and python rhinoscriptsyntax return the group name. Note if the name already exists, it also adds a number after the name to make the group name unique, so the added group name might not be the same as strName… Just a heads-up.
Thanks for continuing this. Upon even further testing it appears as though the groupname isn’t returned (None returned) if the assigned group name already exists…well that seems to be the issue. I ran the full command twice, first time returned the groupname properly, second time (on a different object that had the same name to be assigned to the group) it returned None and crashed out of the command. This was repeatable on a second pair of objects with the same groupname to be assigned to each, first worked, second didn’t.
The simplest solution is probably to explicitly make the groupname unique to avoid this issue. That won’t create any foreseeable issues down the line.
In Rhino 5 and 6 AddGroup() with no arguments creates unique name.
In Rhino 5 passing a name argument will add it if it doesn’t exist otherwise it returns None. In Rhino 6 a number will be appended to the passed name if it already exists to create a unique name.