Message: AddToGroup() takes exactly 3 arguments (2 given)?

I don’t get it…

Rhino.DocObjects.Tables.GroupTable.AddToGroup(sc.doc.Groups.Add(), objID)

The error message is not helpful, but what you’re doing is calling an instance method like a static method. The group table exists in the context of a Rhino document.

sc.doc.Groups.AddToGroup(sc.doc.Groups.Add(), objID)

sc.doc is the instance of the document you need to get the group table of, then call AddToGroup on that.

No idea what this means. I’m learning rhinocommon from no object oriented programming background. :confused:

Did this instead:

            grpIdx = sc.doc.Groups.Add()
            pnlref.Attributes.AddToGroup(grpIdx)
            pnlref.CommitChanges()

No worries. An instance method is where you have an object (sc.doc.Groups in this case), then you call a method on it, sc.doc.Groups.AddToGroup(...)

In your original post, it said Rhino.DocObjects.Tables.GroupTable.AddToGroup(sc.doc.Groups.Add(), objID) and then there is no instance, you’re just using the full namespace+class name, Rhino.DocObjects.Tables.GroupTable.

HTH