Create Surface out of Polyline?

polysurface
rhinocommon
cuttingplane

#1

Hello,
so I have a plane and a mesh and they intersect, now when calling Intersect.MeshPlane(m, pl) I get an array of polylines which are always closed (at least in my case).

To simplify things: Let’s assume that the array of polylines is always of the Length = 1, so how can I create a surface from a polyline?


#2

@Ivan1

The one of the easiest surface to make from a polyline is an extruded NurbsSurface, which you would create like this:

        Polyline polyline = new Polyline();

        polyline.Add(new Point3d(0, 0 + 15, 2));
        polyline.Add(new Point3d(0, 1 + 15, 1));
        polyline.Add(new Point3d(0, 5 + 15, 3));
        polyline.Add(new Point3d(0, 10 + 15, 1));
        polyline.Add(new Point3d(0, 10 + 15, 0));
        polyline.Add(new Point3d(0, 0 + 15, 0));
        polyline.Add(new Point3d(0, 0 + 15, 2));


        var surface = NurbsSurface.CreateExtrusion(polyline.ToNurbsCurve(), new Rhino.Geometry.Vector3d(99, 0, 0));

        if (surface != null)
            doc.Objects.AddSurface(surface);

        doc.Views.Redraw();

If you want the cap, you can also make a PlanarBrep:

        var brep = Brep.CreatePlanarBreps(polyline.ToNurbsCurve());

        if (brep != null)
            foreach (var b in brep)
                doc.Objects.AddBrep(b);

#3

Thanks, this is exactly what I wanted :slight_smile: