Second sorting has no influence

Hi,

I have found code on this forum and it ensures that sorting is done first in X-Direction and then in the Y-Direction or vice versa.
somehow the second sorting goes wrong, this sorting does not affect the first sort order.
If I bypass these nodes then the result is the same.

The numbers in Math.Round = 15 if I lower this, the result is worse.

I hope that you can help.

Try removing your “List.Sort” node and connect the output of “Point.Y”-node to the “Math.Round” node.

What you’re currently doing is:

  1. Having a list of elements (this is ok)
  2. Getting the location of these elements and finding the Y coordinate (this is ok).
  3. Sorting the coordinates and attempting to use the sorted coordinates as keys (this is NOT ok).

Try and see if the below picture makes sense to you:

The reason that it is not ok is that you’re actually breaking the relation between the elements and the Y-location by sorting them prior to using them as keys (in the node that actually does the sorting).

And can you throw a link to the post where you found the graph?

I still don’t get it if i follow your example the outcome (upper right) should be

element 5
element 6
element 3
element 2
element 1
element 4
element 9
element 10
element 7
element 8

the 5 th key represents 5 th element (index 4) in the flatten list

i don’t get the logics behind it

I’ll try to find the graph again.

thnx

What you’re writing does not make much sense…
If you arrange your elements like that you have your “y-values” in the following order:
Y-Value - Element:
1 - element 5
4 - element 6
3 - element 3
6 - element 2
5 - element 1
2 - element 4
8 - element 9
33 - element 10
62 - element 7
78 - element 8

i’ll get it now it gets the lowest to biggest number in the list with its corresponding position.

key1 is at the 5th position so it get the 5th element (index 4)
key 2 is at the 4th position so it get the 4th element (index 3)

etc.

That is the danger of simply following what someone else did without understanding the underlying logic. It will bite you in the a*s :slight_smile:

I do not think this, alone will successfully sort your elements in two directions, not without proper grouping that is.

I guess this means that your problem have been solved for now?

If so please mark the post that solved your problem as the solution.

thank you so far…

I have to take 1 hurdle sorting now goes from left to right and from bottom to top actually I want it from left to right and from top to bottom I have unfortunately not yet found how.

thnx

You could play around with the “list.reverse” node for that.

Please mark the solution for this problem, and feel free to start a new topic if/when you encounter additional problems :slight_smile:

image