Surface from points

In the below code"panel = rg.NurbsSurface.CreateFromPoints(cpts,2,vnum2,2,2)", I want to generate a surface with 1 degree from points. But now, I get a wrong thing.
Thx for ur help!

import random as rnd
import Rhino.Geometry as rg

uinc = 1/unum
vinc = 1/vnum

panels = []

for i in range(unum):
    for j in range(vnum):
        vlen = rnd.randint(1,10)
        if j + vlen > vnum:
            vlen = vnum - j
        cpts = []
        depth = rnd.randint(0,1)
        for k in range(vlen+1):
             cpts.append(srf.PointAt(i*uinc, (j + k)*vinc))
             cpts.append(srf.PointAt((i+1)*uinc, (j + k)*vinc))
        panel = rg.NurbsSurface.CreateFromPoints(cpts,2,vnum2,2,2)

a = panels


some variables are missing in your script. If i add them (unum=10, vnum=10) and add a surface as srf i can see that the points used in CreateFromPoints() seem not to be in the correct order. Can you show a picture or file of what you are trying to get as result from your script ?


Thx for ur attention! I want to make this.


i´ve just changed this line:

panel = rg.NurbsSurface.CreateFromPoints(cpts, vnum2, 2, 2, 2)

note that for degree 1 surfaces, the last numbers should be set to 1 too. (1.1 KB)


Wow! You’re so great! It works! Thank you so much!