Automating Carriageway Edge Selection in Dynamo

I have a Dynamo script where I want to select the 3D polylines of the carriageway edges to the left and right of the alignment. Currently, I have an object selection node that I use to manually select the carriageway edges. Is there a way to automate this in Dynamo using either a code block or Python script to select the nearest left and right edges? Note that all carriageway edges are on the same layer, “Cway_Edges”.

Hi,

I played with a script that you could try and implement. It will check the distance of some points along the alignment to all the 3D Polylines on the selected layer and then compare the average distance from the points to the different 3DPLs.

Check it out and see if it works as you’d wish :slight_smile:

The one thing it currently doesn’t do is separate the left and right side but that could probably be implemented as well.

Previous script

Closest road edges.dyn (68.5 KB)

Edit: Updated the script to separate out the different sides along the alignment as well.
Closest road edges.dyn (102.6 KB)

Hi Henrik,

The script crashed when I tried to run it. Although I can follow the logic, I should be able to get it to work. I am wondering if the script could be simplified using Python. My coding skills are not great, but I have had some success with ChatGPT assisting me lately.

Thanks

Might have to do with the number of points getting compared to on the Alignment? Try increasing the slider for Steps in the Range for Chainage.

I also realised that it would probably be a good idea to set all the elevations of the Polycurves to 0 before making any comparisons against the alignment.
Closest road edges.dyn (107.4 KB)

This could probably be done in Python. I have no idea how though.