Get coordinates of points from a polyline

Hello there

I am trying to retrieve the points coordinates composing a polyline. I know how to do it in dynamo for revit but it seems different for civil3d.
For the moment I am able to select all the polyline I want, but I can’t retrieve any geometry information from it. Any idea would be appreciated

Thanks in advance

@angelohbwang FYI

@GuillaumeQ have you tried using the Object.Geomtry node to get a PolyCurve from the polyline? After that you can get any points as you want.

Thanks for your help.
I can now have access to the first and end points coordinates (with property StartPoint / EndPoint). But I can’t find any property / method to get a full list of points in the Civil3D API. I find strange the fact that there isn’t any PolyCurve class.

Right, Civil 3D API doesn’t have PolyCurve class. Alternatively, you can fully use Dynamo Geometry nodes to achieve your goal. For example, here is a graph to get 11 points with equal distance. PolyCurve is a special Curve, so any Curve nodes can be used on it.

Thanks for the proposition but I need exactly the coordinates of the control points of each polyline. But with your idea of manipulate curve I can now retrieve every points by decomposing polycurve in curves.

2 Likes

Nice solution.

However, I’m receiving this notification when converting an AutoCAD Polyline to Dynamo geometry:


I found out what was going wrong here, it seems I have some Polylines that have multiple vertices at the same coordinate by inconsistencies in the Polyline itself:

Anybody have an idea how to fix this using Dynamo?

I know I can use a Map/Civil 3D command called MAPCLEAN to erase short objects for this but am interested to know if someone can show if Dynamo could do it also?

2 Likes

This error also comes up when Polyline vertices are just very close to each other like 0.007 meters.

Hello @GuillaumeQ, I 've been working on this, but when you obtain the first Point and the last point from a list of polycurves there are equal points in those lists , only the last one of each policurve is missing and you must add them on the Start station list. The questión is , how do you add this point to the list in order to get all the sequence point for each policurve??
Thank you
policurve N = list( first points of all curves you extract)+ (last point of each list of end points)

That’s what i mean.

You can take the startpoint of the polycurve and the endpoints of the curve collection:

You could even create a Custom Node of this.

2 Likes

Thanks Anton, it is useful when you have only one polycurve, but when you have a list of polycurve, you should use List.AddItemtoFront and apply levels of list.

Just for fun, to see if it can work without levels:

It works when you set the lacing of the last node (AddItemToFront) to longest. If you forget that, it will produce a list of only the startpoints and the other lists.

Off course, when you create a Custom Node of this, you should not apply longest lacing because the Custom Node is feeded with single objects:

or you can change your input type to
Autodesk.Object[] and the custom node will accept arrays.

1 Like

Hi thanks for your post.
do you perhaps know how to get te points into a csv file afterwards cant seem to make it happen…
Br. Lars-F

Hi, actually to get the points you can now use the Civil 3D toolki. PolylineExtensions.GetVertices. You can then get the coordinates from the points. To send it to a csv file, you just need to organize data in a list and import to csv (you don’t need to add the .csv at the end of the file path but it will help you recognize it is indeed a csv file - it will only say “file” as a type otherwise) :


1 Like

Hi david thanks for your help

when i use you script i get an error image|425x376

Do you maybe know why i get this error

Br. Lars-Frederik Kellermann

Hi, what version of Civil 3D are you using ? From my experience a lot of problems related to the C3D toolkit come from either the version or the geometry scaling. Make sure you have at least Civil 3D 2020.4 or 2021.1… If problem persist and when there are unexpected errors with a toolkit node like this (make sure it is not linked to the provided input), the best is to post on the Civil 3D Toolkit thread and attach the log file that you can find in the temp folder (you can read the Civil 3D Toolkit thread where Paolo indicates where you can find it).

Did you set the Coordinate System first?