Extract item from list?

I need to extract an item from the bellow list and I can’t find any way to do this kind of operation.

How it is the correct way to do this?

You mean you want to get one of the coordinates in those points? Is it actual point-data, or is it text?

So you mean, you want to retrieve just ONE ITEM from ONE BRANCH?

For that I usually use tree statistics, which outputs the branch path (the number in the curly brackets). So you just get the 2nd list item from that. Then you use Tree Branch to retrieve that specific branch. Now you can use List Item to get the specific item you are after.

The quick and dirty method would of course be to just flatten the output of the last List Item component and get the 2nd list item. But I would be rather careful with that as those kinds of workarounds are usually the places where you have to invest time later on when you are expanding your whole GH script.

I hope that helps.

1 Like

Yes, I want the coordonates of one point (from red circle). It is point data as it is the result of circles intersection.

I already made two dimensions, I just need to make the dimension between the L-R points of the rombs.

Either use @seltzdesign suggestion, flatten your list and use [List Item] to get the point you want, or you can use the [Tree Branch] component. To get the correct branch, first use the [Tree Statistics] component to get a list of all the paths, then use the [List Item] component to get the path you want (i.e. {0;0;0;0;0;1;0}).

Thank you for support.

I managed to find a solution, like the one from the picture bellow. On the cull index I just set two integers (0 2) on the input parameter “l”.

Is it possible to select a series of branches this way? The same way that you would select an item? I would like to select randomly a series of branches. So would it be an option to have a multiple random input for the Path input of a ‘Tree Branch’ component, (which is generated by a ‘Series’ for instance)?

I guess to reformulate, can a ‘Series’ component generate random Paths?

Even if you randomly select branches they will output in numerical order, you will need to randomly renumber your branches.

random replace.gh (7.7 KB)

1 Like

Alright, and how can I then select a limited number of elements from the Tree (while keeping branches the way they are)? Because if I ‘list item’, all items have value 0. :smiley:

Split tree is a the way to go if i understand correctly.