How can I group existing objects in rhino using rhinocommon?



I have bunch of rhino objects:
List<Rhino.DocObjects.RhinoObject> o … retrieved from rhino in C#

I am searching for method to make a groups out of list of rhino objects.

(Menno Deij - van Rijswijk) #2

You need to add their id’s to the group table, which can be found as a property on the document, doc.Groups

(Paul Poinet) #3

Yes, as menno said.
From the group table you can add an empty group and then add the objects to the latter.


Would it be possible to get very basic example?

(Nathan 'jesterKing' Letwory) #5

(From )


Thank you:)

I solved it and your example saved me:

    protected override void SolveInstance(IGH_DataAccess DA)
        GH_Structure<GH_Guid> tree;
        DA.GetDataTree(0, out tree);

        List<Guid> G = new List<Guid>();
        foreach (GH_Guid goo in tree.AllData(true))

        int N = 2;
        DA.GetData(1, ref N);
        bool flag = false;
        DA.GetData(2, ref flag);

        if (flag)
            if (N > 0 && N < G.Count)
                var partitions = G.PartitionByN(N);

                for (int i = 0; i < partitions.Count(); i++)

                    int index = Rhino.RhinoDoc.ActiveDoc.Groups.Add(partitions.ElementAt(i));
                    if (index >= 0)
                        base.Message = "Success";
                        base.Message = "Error";