What's missing is being able to work on all the points within one
"cycle". As it stands now, I can access each one of the points
generated by the Div component individually, but not in the same
script scope.
>
> I follow what your doing but I don't know Python (sadly).
Python's super easy to pick up. It's been called "executable
pseudocode".
Here's an annotated version, explaining the python specific parts:
#import the library that's necessary to work with Rhino geometry
from RMA.OpenNURBS import *
# define 4 lists (like arrays in other languages)
# Because they're defined outside of a function or class, their scope
is global.
A = []
B = []
C = []
D = []
# define a function with 4 positional arguments
def sub(u,v, depth, ud, vd):
if u>=maxu or v>=maxv:
return ""
if depth < 2:
# append adds an element to a list.
# On3dPoint was imported in the first line (as part of
RMA.OpenNurbs), it creates a new 3d point from x,y,z coordinates.
# Keep in mind that A,B,C & D are globals.
# The final result is populating A,B,C & D with the point lists.
A.append(On3dPoint(u,v,0))
B.append(On3dPoint(u+ud,v,0))
C.append(On3dPoint(u+ud,v+vd,0))
D.append(On3dPoint(u,v+vd,0))
else:
# "ud/=2" is equivalent to "ud = ud/2"
ud/=2
vd/=2
# "for X in Y:" iterates over every member of Y, assigning it
temporarily to X
# and executing whateve code comes after the ":". In python,
indentation is part of the syntax,
# so the code block extends to the "sub" call.
for center in ((u,v),(u+ud,v),(u+ud,v+vd),(u,v+vd)):
u,v = center
sub(u,v,depth-1, ud, vd)
u = uv.x
v = uv.y
depth = int(G*j)
ud=(maxu-minu)/i
vd=(maxv-minv)/i
#this calls the "sub" function
sub(u,v,depth,ud,vd)
On Oct 4, 8:57 pm, taz <[EMAIL PROTECTED]> wrote:
> Rodrigo,
>
> Nice. It looks like it's working real well. It does show generative,
> adaptive and parametric behavior with just a single surface. The
> triple crown.
>
> I follow what your doing but I don't know Python (sadly).
>
> I hope other people will start to post some basic scripted work, but
> then things will be hard to keep track of with all the different
> language options floating around.
>
> We'll see what happens.
>
> taz
>
> On Oct 4, 1:13 am, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
> > fixes "holes".
>
> > On Oct 4, 2:10 am, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
> > > Uploaded new file, fixed wholes and ragged edges.
>
> > >http://groups.google.com/group/grasshopper3d/web/gaussian5.wrm
>
> > > On Oct 3, 11:08 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
> > > > Taz,
>
> > > > yeah. I'm not happy with the final result so far, but I do like the
> > > > fact that you can now mix recursive control structures with GH's
> > > > analysis and generative tools, keeping things simple on both ends.
>
> > > > Rodrigo
>
> > > > On Oct 3, 9:33 pm, taz <[EMAIL PROTECTED]> wrote:
>
> > > > > Rodrigo,
>
> > > > > That's starting to look interesting.
>
> > > > > David,
>
> > > > > Any plans to setup a splinter Google group for scripting based
> > > > > discussion?
>
> > > > > Or do you want to kick it all back to the plugin NG?
>
> > > > > Anyway, for my own (selfish) benefit I like to see more VB.NET
> > > > > scripting examples.
>
> > > > > taz
>
> > > > > On Oct 3, 11:12 am, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
> > > > > > "... who's also doing Python for Rhino5"
>
> > > > > > That's the best news I've heard all month!
>
> > > > > > Thanks for your reply.
>
> > > > > > Rodrigo
>
> > > > > > On Oct 3, 12:06 pm, David Rutten <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi Rodrigo,
>
> > > > > > > you have to somehow get an instance of an OnSurface or OnBrepFace
> > > > > > > class, then you can call evaluation functions on that.
> > > > > > > I sadly don't know python very well (Python for Grasshopper was
> > > > > > > developed by Steve Baer, who's also doing Python for Rhino5.)
>
> > > > > > > I do know that computing curvature values is not easy. In fact,
> > > > > > > it is
> > > > > > > astoundingly difficult. There's a bunch of functions available in
> > > > > > > OnUtil and maybe RhUtil that do some of the work, but you'll have
> > > > > > > to
> > > > > > > ask this on the Rhino plugin newsgroup, where the McNeel math guys
> > > > > > > hang out.
>
> > > > > > > --
> > > > > > > David Rutten
> > > > > > > Robert McNeel & Associates
>
> > > > > > > On Oct 3, 4:48 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Have posted an example of using python (and the scripting beta
> > > > > > > > version, of course) to recursively subdivide a surface
> > > > > > > > according to
> > > > > > > > its Gaussian curvature. Still kind of rough, and has some holes.
>
> > > > > > > >http://groups.google.com/group/grasshopper3d/web/gauss.3dmhttp://grou...
>
> > > > > > > > Questions: How do you evaluate a point on a surface from python?
> > > > > > > > Gaussian curvature? What I'm doing here is evaluating the
> > > > > > > > curvature
> > > > > > > > before going into the script, but it would be much more
> > > > > > > > flexible if I
> > > > > > > > could do it from the script itself.
>
> > > > > > > > Cheers,
>
> > > > > > > > Rodrigo Culagovski
> > > > > > > > parametrica- Hide quoted text -
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -