Combining three lists in a single list using python or by any other function

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 (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: (25.6 KB)

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: (24.9 KB)

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: (25.2 KB)

To be really minimalist about this, the Python is one line of code:

import rhinoscriptsyntax as rs

a = x + y + z
1 Like

If I understood you correctly (i.e. essentially to flatten a Datatree), here’s one approach: (23.4 KB)

Edit: For a non-Python vanilla Grasshopper solution, use Merge:

Thank you all. :slight_smile: