Have you tried changing the SelectionMode?
rs.Command("_SelBoundary _SelectionMode=_Window selid {} _Enter".format(str(obi)))
Or
rs.Command("_SelBoundary _SelectionMode=_Crossing selid {} _Enter".format(str(obi)))
and maybe add a check that it is a textbox before adding to group:
if rs.IsText(a):
rs.AddObjectToGroup(a, i)
Last suggestion: if you don’t need to keep track of the group names. You could just let AddGroup autogenerate a name rather than passing ‘i’ in.
AddGroup(group_name=None) Adds a new empty group to the document
Parameters:
group_name (str, optional): name of the new group.
If omitted, rhino automatically generates the group name
I actually asked a related question without realizing you had posted this question yesterday. Here is my post in case someone replies to mine. Select Contents of Closed Curve