I wanted to add another solution to the discussion as I have worked on a similar problem of sorting lists this week.
I ended up using one of Python's abilities to handle lists which is called groupby() because I did not want my head to hurt thinking about how to go about this in Dynamo... ;-)
- Sort list by X values using the method Steve explains above
- Sort list by Z values
(Notice that within each group of equal Z values, the X values retain their order from the previous sort operation)
- Create a list of lists with XYZ values (sublist 0) and just Z values (sublist 1)
- Group that list of lists by the Z values (using a custom node with some Python code inside)
- Extract only the list of lists of XYZs by combining two map nodes
You will need the package Group List of Lists By Key for this to work.
(For what it's worth, I also uploaded another package called Sort List Of Lists this week which was related to that project but isn't needed here. But it might be worth checking out, too.)
here the other day. I am now using a custom node called Almost Zero (also in the package manager) as tolerance for XYZ-based calculations and rounding.