How can i sort surfaces in rows

Hi everybody, i made a lot of surfaces in z, i could difference them into branches depends their areas, but know i want to sort the surfaces in rows in z. Because then i will move the rows. So i need help to pick some surfaces, interior surfaces that a put in red in the image and sort in rows like the other image that i attached. I upload the rhinoceros and the grasshopper if anyone has a doubt.
I put the last in two colours because i will divide in two parts because they will move in opposite directions, but know how to do this part
Im expecting your answers, thank you

How%20to%20pick%20the%20surfaces%20an%20sort%20in%20vertical%20rows|690x351 Surfaces that i have to pick and sort.3dm (4.7 MB) how to took surfaces specific surfaces from a tree and sort in (40.1 KB)

Don’t fully understand your question
Do you want to put surfaces in a vertical stack together on a branch?
if so I have a quick example here (21.7 KB)
It will require a K-means grouping. There are numerous plugins available and you can write your own, but I’m using the one that I made. You can find it as part of a PCPA_GH library here.

1 Like

I just can solve it, thank you very much for the plugin, it wasi needed, it will serve me for the future!