Trying to connect new pattern after culling

Hi guys, Im trying to extract a ridge (yellow sketch) from the following script after doing some culling pattern to eliminate the polyline curve, so I can connect the dots in the segmented vertices using the Explode. But the pattern of the new list is jumping around and not in order, and the result when interpolate it happened to be like in the second image. Is there any solution for this data management ?
Thank you very much.



Roofing.gh (33.4 KB)

This could be a way…


Roofing_re.gh (13.9 KB)

1 Like

Thank you for the assist. I think I figure out where I was wrong and see the proper logic from your solution.
Appreciate the help