algorithmic modeling for Rhino
Hi, I have never used Python before so I have a question how to do rather (I think) simple task.
I want to generate a list with numbers up to n but I want to have n lists where the number of items in lists is the number of the list. Huh this is hard to understand so I will just sketch an example:
n=4
Tree with 4 branches, each branch is a list with different length:
1.
1.
2.
1.
2.
3.
1.
2.
3.
4.
Maybe there is a way to make this in just grasshopper but I thought it should be python
Tags:
ok, I have found partially an answer:
listoflists = []
a_list = []
for i in range(0,x):
a_list.append(i)
if len(a_list)>0:
listoflists.append(list(a_list))
print listoflists
a = listoflists
this prints me this:
[[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6, 7]]
this is what I wanted but how to convert this to tree in grasshopper?
In grasshopper I just get:
8x IronPython.Runtime.List
I had a similar problem. This thread summed up the solution:
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