SortPt - sorting z-coord - something went wrong?

Hi all,

does anybody know why the SortPt does not sort the points according to their z-coordinate?
See point 0 to 3 in the following screenshot.


Shouldnt it be
0 3.0, 3.3, 19.25
1 3.0, 3.3, 22.35
2 3.0, 8.9, 19.25
3 3.0, 8.9, 22.35

Simplified gh file attached.

Thanks for your help and time.
Best Florian (14.8 KB)

Because sorting priority is X, Y then Z

It might be displaying as the same, but 2 has a smaller Y value, so it came first
i’m guessing there’s rounding involved somehow, I don’t have a solution for you, just an observation.

In this way you can sort points by seeing the Z value of the points.

1 Like

That’s the not the issue, The issue is he wants to sort via XYZ but as you see the Z’s are incorrect, which like @victorlin said there is probably some floating point error somewhere. My guess is in the Y values where something like the part of the list which goes:


might actually be something like


Hence the Z appearing out of order.

Thanks evo! To know the reason is the first step on finding a solution.

Thanks mikity. I will try this one.

Solved the issue by using ‘round’ before sorting

Maybe there is a more elegant way, but its fine for the moment. Thanks to all!

1 Like

Ouch, I’m sorry if I made any confusion… I thought “3” supposed to be right after “0”… Yes now I see that he said “3” shuold be right after “1” .