Sort start points and end points in a nested list by distance to a master point about X and Y

Hi,
I have attempted to sort curves such that the start point and end point are sequenced from west to east and south to north I have been trying to arrange a list of nested points by their distance to a master point located south west of the project.

Note, this problem is dealing with points in the X and Y and not Z. (Position in plan)

I have succeeded in changing the sequence of a single curve by arranging the start and end point (as per above requirement) using the sortkey node. (KEYS-distances of points to master point and LIST - start and end points)
However, I’m now finding it difficult to apply the same technique for a number of curves. The node needs to be adapted to suit the increased data. My first attempt was to use list mapping in combination with the sort key node but i did not have any luck.

I have attached a dyn file that shows the single curve point sequence that was successful.
I’m currently still working on more attempts for working with multiple curves and will post progress when I have it.

The last image outlines the problem at hand.

There are also some screen shots of the single node to explain the process.
I would love to know if anyone can help with this problem?

Thanks

start point and end point fix single curve.dyn (37.3 KB)

Approach your problem in a different way: Use an if statement like this:

This will not only get you the desired result, but you’ll also be able to use this same graph on arcs, splines, etc.

2 Likes

Jacob,
This is perfect. Exactly what i needed. i was not aware of the “curve reverse” or object identity. Thank you for introducing me to such an inventive workflow. Please find below my updated script with your help. I have highlighted the nodes that are new to me and I can see these will be valuable in the future. Thanks I really appreciate it!

Glad it worked out. Please mark a post as the solution so others can reference this post and learn in the future. :slight_smile:

1 Like