Sort Polyline curves with same Z coordinates to same data tree branches

I’m trying to make a data tree, containing all the polyline curves with the same Z-height in the same data tree branch. I currently have all the polyline curves in different branches, but as shown on the picture on line 2 there are 2 polylines on the same height. these should be in the same branch.
Thank you.


Can you upload your GH file with internalized geometry ?


Sort for Z (15.9 KB)
Hi I added the file here. If you’re missing any data, please let me know.
Thank you

They appear to be grouped by branch already.