Grasshopper

algorithmic modeling for Rhino

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 some thing wrong. I want to get some planar surfaces. 
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))

                 vnum2=int(len(cpts)/2)

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

a = panels

Views: 1740

Replies to This Discussion


I want to make the result like this.

I used "panel = rg.NurbsSurface.CreateFromCorners(cpts[l],cpts[l+1],cpts[l+3],cpts[l+2])"to generate planar surface. But when I want to join this surfaces, it went wrong.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service