Sort point with Y and Z coordinates

Hi! I am struggling with organizing this point according to their y and z as shown in the red. Every time I use sort by they never are in the crescent order. Do you know how to do it?

can you share the sample file and with how much you done?

So, first I sort by Z


Then, I group by Y but as you can see there is no order at all

image
image

This scenario has been asked about many times before. Please try searching the forum for similar topics before starting a new one. You just need to apply the correct list levels.

3 Likes

I m not finding anything similar. Do you know where i can look for ? Or do u have any example?

give me a moment @MariaLauraLeonardi ,

i’ll create something for you

Thanks a lot

Take a look at this:

2021-05-06 SortPointsByZThenY.dyn (18.7 KB)

1 Like

It depends on what exactly you’re looking for, but those should get you started.

2 Likes

Thanks a lot! Is the node that you used the same as this?
image
because I see a little difference

Yes, i am just in a newer version of Dynamo

Unfortunately is not working :frowning:

Are your Z-Values and Y-Values rounded?
If not maybe you can use a Math.Round node in between. (Then you need to change the List.SortByFunction node to List.SortbyKey and get your key inputs from your list (with a Math.Round in between).

PS: you dont need to flatten / shuffle the list, i just added those in my script to show you that it works with any input

2 Likes

Always round your values when comparing. Dynamo makes precision issues at longer decimal lengths.

thanks, im trying

thanks

My issue with rounding is then that I put together these two z values
image

I really dont know how to figure this out

Have you tried the Math.Round node where you can set your decimals?
Maybe try setting it to 1 or 2 decimal points

1 Like

sorry, i just see the problem

but i am having this final issue
image