I got a python that I’m using the implicit grasshopper cycle to output a Tree.
In the Python I’m using a Tree input as Tree Access and another Tree input but as List Access in order to create this implicit grasshopper cycles.
Problem I have is when I use ghpythonlib.treehelpers - tree_to_list() it will always select branch 0 and not the corresponding brach of the list input.
I need iterate from the First tree structure with its corresponding brach from the Second Tree Struture:
{0} uses {0:0} and {0,1}
{1} uses {1:0} and {1,1}
{2} uses {2:0} and {2,1}
However using this code:
import rhinoscriptsyntax as rs
import ghpythonlib.treehelpers as th
ValuesList=th.tree_to_list(Values)
for i in Names:
print i
print ValuesList
I get this result:
I found that I can use List instead of tree and loop through the count range using:
import rhinoscriptsyntax as rs
import ghpythonlib.treehelpers as th
for n in range(0,N):
print n
NamesList=th.tree_to_list(Names, lambda x:x[n])
ValuesList=th.tree_to_list(Values, lambda x:x[n])
for i in NamesList:
print i
print ValuesList
it works, but it returns a list and not a tree
is there a way to find or the tree path for the inputs or count the implicit Grasshopper cycle to pass as an integer on ValuesList=th.tree_to_list(Values, lambda x:x[n])
thank you
PyTree_Test.gh (12.6 KB)