getting the nearest points on the polyline from the base point

hello, I can’t figure out how to set the logic for Dynamo so that it checks which nearest COGO points are on the polyline from a given COGO point(group of points) on the same polyline. I made a script where I found all the points on the polyline and all the points from which
I need to make a check, but then I’m at a dead end


at the output, I would like to get a list of something like this
example2
That’s what I have at the moment

Hi Aleksey, welcome :wave:

You’re on the way - sorting by distance requires a bit of list logic but doable
Once you have your (geometry) points selected you can check against each point in the list using list levels and the Geometry.DistanceTo. Once we have that information it is a matter of slicing and dicing and finally sorting by keys

2 Likes

Curve.ParamertAtPoint might be a better sorting means than distance if you want to take sequence into account.

Thanks for the reply. I figured out how to get all the points and their distance from the zero point on the polyline, this solves my problem by half and I don’t understand how to get the zero points that are adjacent and the distance to all the nearest points on the polylines. I attached a DWG file, you can see an example if it’s not difficult for you
test.dwg (683.3 KB)