Creating a group in a 3dm file

I haven’t been able to figure out how to use RhinoCommon to create a group of Rhino objects in a File3dm object. I found this closed issue: https://mcneel.myjetbrains.com/youtrack/issue/RH-34622 which suggests this is supported, but as far as I can tell there isn’t a way to create a Group object (no constructor) to satisfy this method: https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_FileIO_File3dmCommonComponentTable_1_Add.htm. Am I missing something? Thanks!

Hi,

FWIW:
you can use Add() to add a group to the table:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_GroupTable_Add.htm

To add objects to a group:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_GroupTable_AddToGroup.htm

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_GroupTable_AddToGroup_1.htm

HTH
-Willem

Willem,
Yep, you can do that on a group in an active Rhino document, but I’m looking to do the same on a File3dm object, i.e. a representation of a Rhino file. For that the Group class is a little different: https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_FileIO_File3dmGroupTable.htm and there doesn’t appear to be an “AddToGroup” method.

1 Like

I also fell for the docobjects group table, that’s why I deleted my first answer again… In the meantime I had a look at the code, the group constructor is internal, this is why you can’t get to it from the outside. maybe @stevebaer or @dale can answer why that is?! I just worked on adding groups to a file through python/c++ and it worked fine… so either I broke the rules or the thing should be public?

@fertig, @trygve - I’ve made an issue so we can get something added.

https://mcneel.myjetbrains.com/youtrack/issue/RH-56334

– Dale

1 Like

@dale Thanks! What’s protocol here? Should I mark your reply as the solution since this has moved to YouTrack, or leave it open until something is added?

Hi Trygve - nobody here really uses the Solution feature here so that’s optional. When / if the YouTrack item is closed, this thread will be notified.
-wim