Sort a list of points with difference between the coordinates

Sorry, my language is not good
Hello all
If you can help please

Is it possible to get the order of the points as in the attached picture example

Even if there is some slight difference between the coordinates

I found the idea, but if there are no differences between the coordinates, as in the link

I hope I made my point clear

q sort by locatio.dyn (16.7 KB)

Hello…could “list reverse” help you in that case

I used this code
But it needs modification
Any idea to reach the goal as in the example picture


import clr
orglst = IN[0]
orglst.sort(key = lambda orglst: (orglst.Y, orglst.X, orglst.Z))
OUT = orglst

Hello @hosneyalaa
I have done this exercise, you can further modify the script as per your requirement

You can further sort the group as per group average.

1 Like

HI @honeyjain619

attach the code

Hello @hosneyalaa

Home11.dyn (24.0 KB)