 How to position point in the closest item from a list?

Hi guys (again) , I want to position a point along a curve.
I am using another script to create the point along the curve but before this point is located for good, I want to cross reference it by taking into consideration a list of points(constrains), where if the point is not within this list, I want it to be positioned in the closest point from the list. If it is within the list points, it shall be positioned as scripted from the first script.

Is this possible in Dynamo by itself or is Python required?
Thanks in advance. Yes.

Geometry.DistanceTo to get a list of distances from your base point and your list of allowable points, and the a List.SortByKey and a List.FirstItem node. Lacing and list levels will matter for a list of base points.

2 Likes

Thank you for the reply, but I would very much appreciate it if it was possible to show me the graph? I find it difficult yet to comprehend how it works.

Start by using Geometry.DistanceTo to compare distances between points. Make an attempt at solving this yourself before asking for a finished graph.

1 Like

So far i was using this method, because it was the one i could understand how it works… but the one you suggest asks for geometry…what do i put in geometry input ? the point number 1?

The geometry would be the points, yes. You would get the distance between the current point and the list of acceptable points. Then you use the point with the smallest distance aka the closest acceptable point.

1 Like