Sort lots of lines according to their z-coordinates

Hi everyone, I don’t have a lot of experience in grasshopper, and i encountered this problem that i couldn’t think of a good solution:

Here in the 3dm. file is a bunch of lines which actually are where the mullions should be on from a tower model. I want to sort all the lines in different lists according to their rows.

The way i was approaching was to and get the z-coordinates values of one end of the lines, and compare all these numbers, the difference smaller than certain number should be in the same row. But am not sure how exactly to set the comparison script…

Thanks for any input in advance!

HNMullion locator.3dm (708.5 KB)

Do you have a grasshopper file? I didn’t look at your file ubt you should probably look at the sort component. The first input will be the list of numbers to sort (your Z-height) and the second input wil be the list of curves to sort along with the first list (so your curves).

There are some duplicated and short segments, so they were excluded and sorted by row… (156.6 KB)