Sort by range of Z values

Hello All,

I have surfaces on 3 different layers.

as you see in this side view, I’m thinking of 3 different levels in Z.

Level 1 : 0 to 15
Level 2 : 15 to 45
Level 3 : 45 to 60

What I would like to do is to sort them by their layer and their level in a single tree, so it would look like this:
{0,3,3} for {surface,layer,level}

I’m able to sort them in 3 branches for 3 different layers here

what I would like to add to this is so that they are also grouped by their levels, for Z value 0 to 15 is another branch, 15 to 45 is another, and 45 to 60 is another. Any ideas?

Thanks so much!
Gh file: (17.9 KB)

rhino file:
sortbylayerandlevel.3dm (137.1 KB)

thank you all!

This should give you the DataTree structure you’re looking for. (12.3 KB)

References geometry in your rhino file posted above.


Added labels to surfaces. (15.8 KB)

Again, references geometry from your Rhino file.



This is amazing, and without a plugin!! Thank you so much Kevin