How to create a plane surface that is more that 5 points?

from Rhino.Geometry import NurbsSurface, Point3d
from scriptcontext import doc

surface = NurbsSurface.CreateFromCorners(
Point3d(5, 0, 0),
Point3d(5, 5, 5),
Point3d(0, 5, 0),
Point3d(0, 0, 0));

doc.Objects.AddSurface(surface);
doc.Views.Redraw();

This seems to work only up to 5 points only. How can I do more than that? Or create a plane from lines works too, but what I found only script that makes user to pick curves to generate the plane. How to automate the selection without interruption?

Thanks.

Well, if you want the surface border to have more than 4 corner points, you will need to create the planar curve(s) which represent the edges first. Then you will need to use Brep.CreatePlanarBreps() and feed it one or more planar curves. If you are starting with points and want linear edges, you can create a PolylineCurve from your point list and use that for the curve argument in CreatePlanarBreps().

import Rhino
import Rhino.Geometry.Point3d as P3
import scriptcontext as sc

ptA=P3(0,0,0)
ptB=P3(10,0,0)
ptC=P3(10,10,0)
ptD=P3(0,20,0)
ptE=P3(-10,10,0)
ptF=P3(-10,0,0)

pl_crv=Rhino.Geometry.PolylineCurve([ptA,ptB,ptC,ptD,ptE,ptF,ptA])
breps=Rhino.Geometry.Brep.CreatePlanarBreps(pl_crv)
objIDs=[sc.doc.Objects.AddBrep(brep) for brep in breps]
sc.doc.Views.Redraw()

–Mitch

Thanks, Mitch.

This is very useful. On a side note, is there a way to store the curves into an array like container. say I need to do this procedure 5 times. Instead of naming everything this way, pl_crv0, pl_crv1, pl_crv2, pl_crv3, pl_crv4, I would like to use sth like pl_crv(0), pl_crv(1), pl_crv(2), pl_crv(3),pl_crv(4). Is this possible?

Also, how do I reference the plane that is generated? is that variable breps storing the plane object ?

Thank you.