Get kilometer point from the alignement

hello guys

i have a block with an attribute for kilometer point (circle) and i want to get de the closest kilometer point from the alignement.
is it possible ?
see picture for more explanation

thank you all

HI @dr.hybride ,

Sure! A workflow like this should get you started:

  1. Import the Alignment curve as PolyCurve into Dynamo.
  2. Import all the Circles as one list into Dynamo Circles.
  3. Get the Centerpoint of said circles.
  4. Use the node ClosestPointTo to get the closest points, measured from the points, to the Alignment Curve.

Now when you have these points you can do whatever you want with them, i.e. place BlockReferences.

2 Likes

Nice Daan,

Seemed to work well. Sound warning. Didnt realize my OBS was picking up my spotify :sweat_smile:


Get Closest Point Along Alignment.dyn (72.3 KB)
GetClosestPointOnAlignment.dwg (817.5 KB)

3 Likes

thank you very much
great job but when i open it there is nothing , may be because of my version of the DYNAMO or C3D ? i have C3D 2021
or can you just zoom + to the script please

Ive had that issue before. Normally i have to make sure I’m using the correct civil 3d launcher. Make sure it isnt an autocad launcher. I’m using 2022 but it shouldn’t make a difference. I can post pictures when I’m back on my home PC.

1 Like

thank a lot :grinning: :+1:

1 Like

just an other question
can we do the same thing with a polyline ? i mean it is not a alignment.
thank for your reply

Sure, you just need to import the PolyLine as PolyCurve, the same way as the Alignment.
The Civi3DToolkit has a great node for this. Something along the lines of PolyLineExtensions.GetCurve (not sure about that exact name)

1 Like

hello guys

i tried all day but i failed :sob:
can someone help me
thank you
Dessin2.dwg (943.5 KB)
Point kilometrique.dyn (43.9 KB)

Can you help me ?

Sure. Will check it out after my office hours. I have to get some park improvement plans out today.

You did great and were close. You needed to compare the list “all curve points” and the “Geometry.ClosestPointTo points” list using a list.contains node (with leveling @L1 for the “item”) to return a list of true/false values. You can apply this true/false value list as a bool mask to #1) All of the geometry points to return a list of just the “Geometry.ClosestPointsTo” points in the correct order / #2) The sum of lengths (station value) for each point, to remove station point values for geometry points and only leave the “Geometry.ClosestPointTo” stationing. Compare this to what you had before and reach out if you have questions.

P.S. It’s important to add that since it’s not an alignment, there is no inherent direction. So if you’re trying to make sure the alignment stationing labels are in the direction you want, you may need to create a bool toggle node that gives you the option to reverse the direction.

Dessin2-SW.dwg (934.1 KB)
Point kilometrique-SW.dyn (58.2 KB)

hello

thank your for your quickly reply
but it still does not working for me :sob:

i dont know why for me the lenght of the curve there are some value null and 0 it noticed also " the curve has infinity" thing like that then when i compare with node list.countain it only found 2 true values
it very strange may be because of my version C3D or dynamo ?
see below

This is some very odd behavior. I have no idea why you’re getting so many null curves and such. I used the same dwg and dyn so I’m not sure what it could be :o

Finaly

i found a way which is easyest thank to Node AlignmentExtensions.GetStationOffsetElevationByPoint in camber package (thank to mr jensen)
you just need to convert you polyline to a alignment

thank all

2 Likes

That node is actually from the Civil 3D Toolkit, so I can’t take credit for it. Glad you found a solution!

Hi!
I trying to do something similar (just trace by one straight line from a bunch of points (block references) to one of the closest polylines to them, but consistently get wrong results.
Where I’m wrong?

So in this example, you have three lines and a list of points. For each point you want to find which line is closest and then draw a line from each point to the closest line?

Absolutely right.