Hey all, First time poster here.
I have encountered a problem with the sorting of Nested/Lists within Lists. **I need to find a way to sort unsortable values from all the Nested Lists (‘branches’) in one list, using the keys of sortable values from the corresponding Nested Lists of another list. I have a grid of points and multiple attractor points and have created a list of distances from each grid point to each of the (3) points. By transposing this list, I have created Nested Lists for each grid point, listing the distances to each attractor. The goal here was to select just the first item of each list (shortest distance), and end up with a list of distances corresponding every grid point to whichever attractor point was closest to it. Using Sort List, I was able to arrange the distances in each Nested List from smallest to biggest. Critical to this was to change the lacing setting of the Sort List node from shortest to cross product.
Now, I want to do the exactly same process with Vectors that are constructed between each grid point and each of the (3) attractor points. The end goal here would be to have a a vector constructed between each grid point and whichever attractor is closest. The problem is that I cannot sort the list of vectors in the same way. I need to find a way to sort the unsortable vectors from all the Nested Lists in one list, using the keys of the sortable distances from the corresponding Nested Lists of another list. I tried to use the sortable keys of from the List of distances to sort the vectors using the Sort by Key node, but it outputs null. To confirm that this was the right direction, I isolated the first Nested List from each list (vectors and distances), and successfully sorted the vectors using the distances. It seems like I am close to a solution. Maybe i’m missing something, or some settings.
Understanding Nested Lists as Branches (grasshopper), I can identify how to do this in GH, but in Dynamo its not working.
If anyone out there can help, let me know.