algorithmic modeling for Rhino
Hi,
this is my first post. I've reached the point of grasshopper knowledge where I need to build a recursive function and decided to go with Python as my language.
I understand the basic principals of recursive functions, but I get stuck on the basics of python in grasshopper.
First, how do I manage a GH list input as a list in Python?
I would believe x[0] would retrive the first item in the list, not the first position/letter of the last item in the GH list..
Studied atlv.org, code.algorithmicdesign.net, designalyze.com without success.
(Copy&paste-GH-functions, HoopSnake nor Loop won't solve my recursive problem)
Last... My end goal is in the form below:
α0x = ξ0
(lj-ξi-1)αi + ξi-1= ξi
Where α is a GH list of floats (Galapagos intervalls of 0.00-1.00),
the size α of will govern my end condition.
x is one value, integer.
lj is a GH tree with 4 levels {0,0,0,0} but only one value in the perimeter branch.
To the more experianced out there, do you foresee obstacles with the above? Any inital tip? or a complete solution? ;)
Tags:
Found in debugging an error.. Corrected version:
from Grasshopper import DataTree
pylist = [list(i) for i in alpha.Branches]
outputList = []
for j in range(pylist.Count):
for k in range(len(pylist[j])):
if k == 0:
p = pylist[j][k]*X
outputList.append(p)
if k != 0:
p = (lj[j]-outputList[len(outputList)-1])*pylist[j][k]+outputList[len(outputList)-1]
outputList.append(p)
a = outputList
print a
The file is missing :(
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by