Sort Points By X and Y Values

Hi All

I have lists of points gotten from lines sorted by their angles.
I am trying to get the points within these lists with the highest X or Y values. I cannot seem to work out the logic for doing so.
The end goal is to use these points to define lines that I will use to dimension grids in plan views.
The way I envision this working is that the maximum X values are given precedence, and if the points all have the same maximum X values, then the maximum Y values are used to sort the points. I hope this makes sense. Please see the diagram I have made to explain further. Also, find attached a Revit and .dyn file.
Thanks for your help.
Sort Points by X and Y Values.rvt (5.9 MB)

Sort Points by X and Y Values.dyn (18.3 KB)

@c.poupin @haganjake2

There are quite a few similar topics on the forum already. Give them a look and see how they’re using SortByKey to sort by both coordinate values individually. If you have any questions after that, let us know.

Thanks for the response.
I did look at those, but I guess not well enough.
Will look again.

If you can link some of the other posts and reference specific issues or questions you had we can get you some clearer answers.

Is this what you’re looking for?

Edit: Ignore the values on the right most node, I had them sorting by X, swapped it for Y after I re-read your post and forgot to re-run it before taking the screenshot. Also there isn’t logic built into to check for matching x or y values in the lists…

1 Like

Okay, spent a bit more time with it. I think this is what you were aiming for.

Sort Points by X and Y Values.dyn (47.7 KB)

1 Like

Hi there thank so much.
I will look through it and revert soon. Much appreciated.

Thanks for your help.
This was pretty much what I needed. It just needed a little tweaking. I had to swop the true/false inputs at the if node and change the levels.
I also sorted the input curves to have the same direction.
See the .dyn file attached.
Thanks again.

Sort Points by X and Y Values.dyn (77.2 KB)

1 Like