Adding items by branch from a list to another list

Hi everyone,

I’m trying to put all items from a list to another list, but each one inserted by branch, like that:

I’ve already tried some List components but with no success. Thanks in advance :slight_smile:

If you have the same number of items as branches then:

1 Like

I actually have, but idk why the list is picking in a wrong order, look:

Instead of picking in vertical groups, it’s picking horizontally, and the list shows groups in the same amount of elements as there is in the vertical order… so weird. (there are 49 lamelas in each column and there are 10 columns)

You need to upload code. Can’t really do much with images.

Your wires in your canvas are not helping you. Please enable “Fancy wires”

You need better understanding of lists and datatrees.

2 Likes

if you have as many elements to insert as the number of branches in the target list, and your target list has Paths which are just progressive numberings like {0}, {1}, {2}… then you can do this, where A is the target list, and B the list of items to insert:

note that B is originally a flat list that gets grafted, and both A and B get simplified to avoid pathing mismatches

the above is the very general and basic case: if you have data trees with particular paths probably you’ll have to pass it through a Renumber Paths, while if you want to inser each item to a particular (or all different) index the better to use Insert Item like suggested by Ftzuk

1 Like

Thanks for the tip, didn’t know that option :slight_smile:

And yes, I know I need. That’s why I came here with this problem asking for help. What do you suggest to solve it?

Two suggestions have been made that you ignored. :man_facepalming:

3. Attach minimal versions of all the relevant files

gh_example.gh (46.1 KB)

here :slight_smile:

I didn’t ignore, it just didn’t work when I tried here… I answered him.

I’ve sent the gh file here, sorry for sending it later because I was trying the alternatives suggested earlier

Thanks for helping :slight_smile: this actually works to include the values in my list, but idk why the list is still choosing the wrong elements :confused:

elements in your data tree are branched by columns, left-to-right in this view, where the paths are like:

each branch contains elements sorted from bottom to top, so index 0 is the lowest one, index 48 is the top one:

items you want to add to the list are already sorted left to right (like the Branches):

so you might want to add that element as last one of each existing column (column = Branch):
[no Flip Matrix is involved in this insertion]

gh_example_Re.gh (56.0 KB)


you can also use Insert Item if you prefer, both methods yeld the very same result in this case, but Insert Item is designed specifically to insert items at a given index:

Thank you so much! Your didatics is really good, I appreciate it.

I opened this file and despite it shows the branches organized correctly by colors as you did, when I try to select them through “List Item” it is still wrong :confused: … look:

Why it is not selecting all the 50 elements vertically by each column instead of horizontally?

[UPDATE]: When I used the component “Flip Matrix” after merging them, it worked. Thanks again!!

1 Like

nice to read you found your way out :+1:
if you want to dig a bit deeper on data trees I’d suggest this playlist

1 Like