# How to join curves to create a surface?

Hello! I have to create a profile section from lines with corners and fillets.
As a result i have a list of lines . How to join/connect this lines to get one curve from them, so i can make a surface from them?
The join command results an array so its still not a single curve.
Thanks.

``````        var crv = new List<Curve>();
crv.Add(new LineCurve(new Point2d(0, 0), new Point2d(60, 0)));
crv.Add(new LineCurve(new Point2d(60, 0), new Point2d(60, 15)));
crv.Add(new LineCurve(new Point2d(60, 15), new Point2d(10, 15)));
crv.Add(new LineCurve(new Point2d(10, 55), new Point2d(0, 55)));
crv.Add(new LineCurve(new Point2d(0, 55), new Point2d(0, 0)));
crv.Add(new ArcCurve(Curve.CreateFillet(crv[0], crv[1], 6, 0, 0)));

var brep = Brep.AddTrimCurve(curves); ///----works onli with single object , not array,list!
``````

Hi Victor,

Does that work?
-Willem

Hi William,
i tried it -zero result.
also it creates an array of breps, but i need one brep.

Your code is missing a segment:

The last 2 addition of Trim results create new curves, not change the existing curves
And the Trims you apply create 2 small curves I think is not what you want:

Does this make sense?
-Willem

thanks ,it looks working now

now i need to make extrusion of it , any suggestions?

Take the single face f the brep and pass it to:

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

it’s an offset but for a planar face it’s practically equal to offsetting.

-Willem

How can i get a face from the brep?

Brep.Faces
Is the collection you take the first (and only ) face from there.

Im not sure on the syntax to do that because I do all in python.

Does this help?

Thnks Willem! It helped a lot.

Damn . I checked the lines , and trims,cleared everithing. Now the Brep.CreatePLanarBreps drops null.I tried maka a surface in Rhino from this lines and it worked, but not in the script.

``````var crv = new List<Curve>();
crv.Add(new LineCurve(new Point2d(0, 0), new Point2d(60, 0)));
crv.Add(new LineCurve(new Point2d(60, 0), new Point2d(60, 15)));
crv.Add(new LineCurve(new Point2d(60, 15), new Point2d(10, 15)));
crv.Add(new LineCurve(new Point2d(10, 55), new Point2d(0, 55)));
crv.Add(new LineCurve(new Point2d(0, 55), new Point2d(0, 0)));
crv.Add(new LineCurve(new Point2d(10, 55), new Point2d(10, 15)));
crv.Add(new ArcCurve(Curve.CreateFillet(crv[0], crv[1], 6, 0, 0)));
crv.RemoveAt(0);
crv.RemoveAt(0);

foreach (var c in crv)
{
}
var brep = Brep.CreatePlanarBreps(crv);
if (brep != null)
{
foreach (var b in brep)
{
}

//doc.Views.Redraw();
}
if (brep != null)
{
var bb = brep[0].Faces;
var extrude = Brep.CreateFromOffsetFace(bb[0], 2000, 1, false, true);
}
return Result.Success;``````

Hi Viktor,

Out of curiosity I did some tests and found a working setup (in python but I suppose it applies to your code as well)
I was suspicious of the passing of 2D points so I changed it to Point3d with all z values zero.
Second I already made the 2 curves short enough to accomodate for the the fillet and that worked as well:

Hope this will work on your end as well.

-Willem

That’s strange. It does not creates brep , but doesnt drops a null exception when i call