 # Create multiple perpendicular distances between two 3D polyline

Hi, I have a problem to solve that requires Dynamo knowledge. I have to measure the shortest distances between 2 curved road lines in 2D. BUT measure the distance between A NUMBER of points within these 2 lines (and set required number of points manually). The desired distances could be lines, or numbers within an Excel (is under examination).

The final goal is to classify the distances by their range that is also set before. For example 1-2 cm is Type 1 and 2-3 cm difference is Type 2.

I though of using Dynamo for this task but didn’t find yet relevant information

Is there anyone that is able to solve this programming task-AutoCAD problem, or do you know anyone that would be able to do it? or where should I search for help to solve the problem? Any advice on other softwares that I could use or anything that could be of help would be greatly appreciated.

Regards,
Kostas

You could create a List, which consists of n lists depending on how much classification categories you got.

Probably the easiest way would be to transform each curve to a list of points.
After that you can get the Point coordinates with Point.x and Point.y in lists.
Do the same for the second curve and also get x/y.

Afterwards you can calculate the distance between P_curve1(x/y) and P_curve2(x/y) in horizontal and vertical axis. The distance can be calculated via trigonometry. d = sqr( a² + b²)
You have to calculated the distance from P_curve1 to every other point of curve 2, to evaluate the smallest distance. Maybe it´s the best to do this inside a function and return the smallest d. Repeat this for every point on curve 1 and return the smallest distances also.

You can make something like a dictionary and append key-value pairs <key=point_number, value=smallest d>. Afterwards you can sort the key-value pairs by their values into several groups in a for loop + if statements.

Thank you so much for your quick answer. I have found an example on the internet, which actually splited the line to parts and then calculated the perpedicular distance for all those points.
Something though, changed in my goal. The lines are in 3D and I have to calculate both Δx and Δy perpendicular distances for each point (because it is in 3D now).
Is there any possible way I could do that?

Without knowing your current build or the example you found, the general response would be that you can build lines between your points of interest and extract the x,y,z lengths from that line, or simply take the xyz point data from your line points and compare for each.