Hi all,
I am trying to put three lists in a single list one by one. I tried but not succeeded.
Looking forward for your help.
The file is attached here.
Thanks
List_Problem.gh (20.3 KB)
Hi all,
I am trying to put three lists in a single list one by one. I tried but not succeeded.
Looking forward for your help.
The file is attached here.
Thanks
List_Problem.gh (20.3 KB)
It looks like Python is treating the numbers as strings and concatenating them? Taking a VERY LONG TIME to do it! (7.9 seconds!?)
I used Weave instead, though I’m sure it’s trivial to fix that Python:
As for the Python, setting ‘Type hint’ to “float” for the X, Y and Z inputs yields the sum of the three instead of concatenating strings, and reduces execution time considerably:
Oops! I just read your comment in the Python source code and see that I misunderstood your intention. You don’t want Weave:
#Need to generate a list by combining x, y and z lists such that
#it starts with x-values, then y-values and z-values in the end
#in a single list
You want to flatten the output of Entwine:
This is amusing but not what you want either:
When all else fails, Google it!
One more detail, from here - you must set “List Access” on all three inputs:
To be really minimalist about this, the Python is one line of code:
import rhinoscriptsyntax as rs
a = x + y + z
If I understood you correctly (i.e. essentially to flatten a Datatree), here’s one approach:
190712_FlattenTree_GHPython.gh (23.4 KB)
Edit: For a non-Python vanilla Grasshopper solution, use Merge
:
Thank you all.