I have put a poly curve in my points and put it on a slope. Now I have sorted my ZAxis value. (from my polycurve) Now I want my elements that I have filtered to be linked to the same sort so that the difference of the slope can be calculated but the value of the elements is placed randomly.
How can I filter the value of the elements from top to bottom?
Try to join the curve as polycurve (or polycurve by points if you have points first), then use springs nodes to get the points of the polycurve. In my experimentation it looks like the points fall in order when a polycurve is dissolved.
The problem is that I no longer have any curves. My foundation brackets are points.
I order him first the Y and the X. Then the Springs.PolyCurve.Points but I have lost my elements. My list of elements no longer matches the point list.
Sort your elements with their respective points (SortByKey) or sort your points then check back to your original list for the initial index (should match the index of the element as well).
SortByKey lets you sort a list based on another list of keys. In your case you want to sort the points based on their Y and X values. You can also sort their respective elements by those same Y and X values. This ensures that the elements get ordered in the same way as the points.
This should demonstrate the basic idea. I can sort (or group) the points by X value but I need to do the same thing to the elements to keep the same list order. You would sort and group by Y first. Then do another iteration for the X coordinates. The important part is that you’re applying the same sort/group logic to your points and your elements.
Why reverse the list? That would order them right to left. Edit: Unless you meant to do Y first. That would make sense.
And why flatten? That undoes the grouping that you just did.
You have to use list levels here because you have sublists. Flattening the list negates the grouping you did and will therefore ignore the sorting by Y as soon as you sort by X.