# Separate Lists by Z Coordinate when number per sublist varies

Hello,

I am wondering if there is a way to take a list of points and then divide into separate lists based on the Z Coordinate value, something similar to what Partition List would do if you then plugged it in to Explode Tree. However, I don’t think Partition List will work here because the number with the same Z values will vary (for example, 4 points might have the same Z value, then 7 points another Z value, etc.).

Additionally, Explode Tree requires manually extracting each list. Is there a way for Explode Tree to grow as the list is adjusted?

I attached a way of doing it manually and a simple Rhino example of the types of points I’m hoping to separate into lists, but I am trying to find out if there is a way to do it not manually. I appreciate any tips!

Thank you,
Steph
Separate Lists by Z Coordinate.3dm (24.9 KB) Separate Lists by Z Coordinate.gh (16.0 KB)

1 Like

Separate Lists by Z Coordinate.gh (13.3 KB)

Find unique values by delete consecutive component, then cull pattern

This example of MIndex finds points with the same X and Y values, differing only in Z, but you can easily adapt it to find duplicate Z values:

There can be precision issues that require rounding, as explained here:

Thank you so much, @Joseph_Oster Do you know if there is a way to create something similar to Explode Tree but where you don’t have to manually extract each sublist? For example, what if the number of sublists varies?

Dai, thank you so much for your reply and solution. Do you know if there is a way to create something similar to Explode Tree that extracts these lists into separate lists? Your example uses list item, but what if the number of lists changes?

This model (white group) separates your points into branches by their Z values. The cyan group then sorts each branch by their Y values. The purple group is a general purpose ‘Tree/List Viewer’ tool for examining geometry by data tree branch (‘path idx’ slider) and item (‘list idx’ slider).

MIndex_2020May08a.gh (19.6 KB)

The points are internalized, no need for the Rhino file.

1 Like

No I am just using list item to show you how it is structured, but if you put an explode tree to the output of cull pattern you will see they are different branches and you can choose each list 'branch" by its path, Or if you flipped the matrix, you will be able to select each list separately by list item(A one big list of your lists).

1 Like