How to sort by pairs

Hey i have a list of ducts and their nearest horizontal wall and their nearest vertical wall. Now im trying to sort those ducts by those wall pairs. So the final list should look like that:
List0
Duct0
List1
Duct1
List 2
Duct2
List 3
Duct 4
Duct 5
Duct 6
Duct7… and so on, the first 3 ducts have a (potentially) unique pair and the following once are obviously paired. So basically i want to compair each index pair to all other indices and if there are any other ducts in the list with the same wall pair i would like to group those in a list and then look for the next once. Any ideas how to accomplish that?

Hi,

You want to pair the first item of every list i see in the image in one list, the second in a second list and so on? Or is there some kind of filter needed?

i dont wanna just pair each of the 108 items, i could do that for example by choping them into 108 lists and then use ad first to list, then i would have 108 pairs. What i’m trying to do is to filter those 108 pairs by duplicates basically. Those pairs of walls are basically corners, and i want to find all ducts that are closest to those corners. So i have 5 ducts that belong to bottom right, 3 to bottom left etc.
Hope that visualises the problem a little better

Hi,

Try looking into the List.GroupByKey node. The input list would be the duct list and your keys would be the nearest wall list.

@lkichenin
The groupbykey node doesnt give me the result im looking for. Because after i group the ducts by horizontal wall and vertical wall i get a different sorting from if i group by vertical and horizontal walls. And i need the same sorting for both paths, because i use for example for horizontal ducts the closest horizontal walls as my reference for the dimension, and the vertical walls as my reference for the dimension line, but if the sorting order is different at the end i can’t combine those 2 together.
I tryed almost every variation of groupbykey to get my desired result all night but i couldnt manage to get it :frowning:

Here is a workaround I suggest. It requires to generate a master key list by merging your two key lists and use that to sort the ducts.

Thanks this workaround worked, for my sorting Problem, now in theory it should be working, but for some reason the dimension byReference node doesn’t paste the dimensions properly into the view even tho the view is selected correctly, and also the dimensions that do get pasted into the view get pasted multiple times even tho they are not listed in the node output… pretty weird but thats off-topic i guess. Thanks for the help already :slight_smile: