C# Group multi 3D Line

Hello Rhino Developer !

I’m looking for a problem … I try to group several 3D Line created by my program. Indeed, when i’m creating these lines, in Rhino they are assimilate like 1 object singly, so if you want to move the “Barbule” (That’s my plug-in), you have to move each line One by One, and it’s not recommended.
By my side, i try to use the class GroupTab, however with this class you can just select by yourself, in RhinoApp, objects you want to group. So can we group these lines inside the program with a specific method ? :slight_smile:

Hi Benjamin,

I am not sure I understand your question. Are you looking to group a set of line curves together so the select and move as one?

– Dale

Hi Dale, you’re right, but i don’t want to group these lines on RhinoApp. I’m looking to group a list of 3D lines for when i’ll launch my plug-in all lines created move as one.

Here is an example of adding objects to a group.

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsGroup.cs

Does this help?

I’m sorry, i’ll try to explain better . In your example, you select many object on Rhino3D (the app)…
And my problem is: how group the line (on my side, 3D line) I’ve created in my program ? Look this example :
In this code, I have one list of Line to trace my “Barbule”, I add these lines one by one. However I want to group them in a single Object. In the goal to manipulate (In Rhino3D) all lines together.

           for (int i = 0; i < ptCountMulti; ++i)
            {
                // Link the HighLine between them.
                Rhino.Geometry.Line line = new Line(firstList[i], secondList[i]);
                doc.Objects.AddLine(line, colorMulti);

                for (int j = 0; j < nbSmallLine; ++j)
                {
                    // Link the SmallLine between them.
                    Vector3d smallVect = new Vector3d(secondSmallList[idxMulti].X - firstSmallList[idxMulti].X, secondSmallList[idxMulti].Y - firstSmallList[idxMulti].Y, secondSmallList[idxMulti].Z - firstSmallList[idxMulti].Z);

                    Point3d ptSmallFinal = new Point3d(firstSmallList[idxMulti].X + (smallVect.X * lengthSmallLine), firstSmallList[idxMulti].Y + (smallVect.Y * lengthSmallLine), firstSmallList[idxMulti].Z + (smallVect.Z * lengthSmallLine));
                    Rhino.Geometry.Line smallLine = new Line(firstSmallList[idxMulti], ptSmallFinal);
                    doc.Objects.AddLine(smallLine, colorMulti);
                    ++idxMulti;
                }
                // Draw In RhinoApp
                doc.Views.Redraw();
            }

The only way in Rhino to “group” objects is to either make a Group (shown above) or create a Block, which is probably not what you want.

You could make a custom object. But this coding can be difficult.

http://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_Custom_CustomCurveObject.htm

Well, It’s a problem … Last question, Is it possible to add these lines in a same layer, then assimilate this layer as a group (On the app) ?

Grouped object do not have to be on the same layer. But yes, you can add all of your lines on the same layer and then group them together…

Thanks for your answer, i’ll try to do this !