Ordering list of object coordinates by elevation and attach a string for respective elevation

Hi,

I have two lists. One is a list of object coordinates. One is a list of strings that relate to each elevation.
I’m trying to order the coordinates by Z and somehow match the string ordering with the new order Z value list.

I’I’m using the sort by function by plugging in the Z point value to a merged list containing the coordinate and the string with separate. However, sort by function ignores the Z point order as it contains a string at the end.

I’ve also looked a sorting by keys but cannot seems to get the results i require. And finally, i do not want to format the original excel file to change the order and i would like to be able to carry the ordering in dynamo.

The screen shots are below
The images show the raw data reading from two columns of an excel file.
The other image shows the sort by z point failing to re-order as the string is at the end. I tried the command without the string and it worked. However, i need to match the strings to the list of sorted coordinates by Z point.

It would be great if somebody could help. There maybe a alternative and more simple way?

I’m not at a computer, but I usually try to nest these lists while moving data around.

Otherwise, There are also sort by natural order / sort by keys nodes which can be used together to sort lists according to keys. In this case, your keys are the z coordinates, and your list is the corresponding strings.

The list lengths just need to be the same, and in the same order when fed into the nodes.

Hope it helps, although I suspect it probably doesn’t. Sorry.

1 Like

Something like that :wink:

1 Like

Those are some Beefy beams…

1 Like

Beefy beams…that’s nothing, you should see the built up sections. LOL.

Thanks for the suggestion. By assigning the Z point a key and inserting the strings as a list, the “list.sort.by key” node worked. The strings are now in the correct order as the Z points. This is what i was after.

Thanks lot!!