# Closest points to a long curve

Hi, I’m trying to get all points closest to a curve. I think it is only picking up the end point and beginning of a long curve to get the distances to. I’m thinking I need to break up the curve some how so it picks up the closest points along it. Any suggestions to get the true closest point to the curve. Hope this makes sense. Please let me know if I can explain anything else.

Tried this but no luck

So ive figured out that when the NurbsCurve goes from 2 to 3 degrees the distance to functions stop working

Seems to work for me. Would be better if you could share a file to explain the issue.

closest.dyn (9.2 KB)

1 Like

looks like it isnt the nurbscurve degree. Maybe the length of it or bending of it. Heres a file with a line in it and a bunch of parking’s its trying to number. The top line works but the other line below that gets more complicated dosnt. Ideally id like to run a line through all those parking’s and it works. Using dynamo 1.3.3

Closest to line.rvt (452 KB)

I recommend converting your NurbsCurve to a Polycurve and using an average intersection
of the elements geometry to determine the numbering sequence. This is because the “Location” of your elements is defined as the same for each parking space on either side of the row, and this introduces extra calculations to determine which of the two identical points is closer.

Also, your parking spaces are all at different elevations, so to simplify the intersection calculation of all the parks along a planear curve, I projected all the geometry to the same XY plane. Hope that makes sense.
Parking Space Numbering.dyn (20.9 KB)

1 Like

Hi Ewan, I was trying to move the location point of the parking lots to the center to avoid errors in counting. Sounds like I moved this wrong and the original still existed?

I was hoping to use the distance to line method to just pick up parking’s (or doors) on slightly different Y planes. Pulling everything to the same plane is a ingenious idea. I’m just wondering though. If you had a multi story car park, would it pull the car parks from above down and count them all funny? Hope that makes sense

I think you helped me with the original method I have here of the distance too. Thanks again

In a multi level situation you could just first group the parking space elements by the level they are on, adjust the lacing a tad to keep a comparisson of locations on the reference curve for each level, then assess the total number of parks and their numbering (per level) sequence before adjusting the mark values at the end.

1 Like

If I ever get into a multi story situation ill look at this. Can tell itd take me a fair few hours to understand what your saying haha. Sort of do. Thanks though, turning the line into a polycurve has solved my issue for the moment and will make numbering things on slightly different planes with really long lines much easier. thanks heaps

1 Like