Creating a surface from a polyline

Hi everybody,

Il would like to create a surface from a 2D ou 3D polyline.

I managed to extract the points from my closed polyline

Now i would like to add these points to my surface using a Pyhton Script, but the method .AddVertices ask for Point3DCollection.
How can i transform my list of points into a Point3DCollection?

Thanks!

Are you wanting to create a TIN surface in Civil 3D or a surface/polysurface in Dynamo?

a TIN surface in Civil3D

OK before going the API route (more work), is it an option in your workflow to use the TinSurfaceExtensions nodes from the Civil 3D Toolkit or the OOTB node to create a surface from a COGO point group?

1 Like

For some reasons, I don’t want to create CogoPoints.

i want to use the .AddVertices method for TinSurface. But i when i create a Point3DCollection i have this message :

Avertissement:IronPythonEvaluator.EvaluateIronPythonScript l’opĂ©ration a Ă©chouĂ©.
Traceback (most recent call last):
File “”, line 98, in
File “”, line 78, in new_surf
NameError: global name ‘Point3D’ is not defined

I guess that i forgot some declaration but which one?

Here is my code :

l_pts=[]
 				
for i in range (0, nb_pts -1) :
       l_pts.append (Point3D(pts_add[i].X,pts_add[i].Y,0));
 		
tins.AddVertices(Point3DCollection(Array[Point3D](l_pts)))

it’s “Point3d” lower case “d”

Thanks @Paolo_Emilio_Serra1! i feel so ashamed


I have a new issue. Here is the message i get :

Avertissement:IronPythonEvaluator.EvaluateIronPythonScript l’opĂ©ration a Ă©chouĂ©.
Traceback (most recent call last):
File “”, line 96, in
File “”, line 77, in new_surf
TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘int’

It’s the line below :

`l_pts.append (Point3D(pts_add[i].X,pts_add[i].Y,0));`

It’s actually the line above that initializes the for loop (known issue with the line number in the Python editor). You need to count the points, use this range(len(nb_pts) - 1))

1 Like

Thanks @Paolo_Emilio_Serra1

Here is my code complete code.
I have (again) an issue when adding a contour to my surface. When the polyline that define the contour is convex it works fine, but when it’s concave the surface is deleted by the add of contour
surface_from_poly.dyn (18.3 KB)

@Paolo_Emilio_Serra1: it would a good idea to add a new node to Civil3DToolkit that can ass a contour to a surface

1 Like

It is already possible.

The node you mention add BreakLines, and not Contours. I tried it, and it doesn’t work for my purpose.


 or i don’t understand hiw to use it!

It’s not adding a contour directly, but what I was meaning is that adding a breakline with constant elevation is essentially the same as adding a contour.

Sorry, but i don’t understand

A breakline can be a contour if it’s convexe. If it’s concave it can’t

below a surface and a polyline (in red) use as a breakline. You can notice that it’s not a contour.

Hmm
maybe we are using different definitions for “contour”? In my mind, the red line is an elevation contour because it represents a line of equal elevation. The result you show above with triangulation outside of the boundary would also occur if you add the line to the surface as a contour instead of a breakline, correct? The issue of convex vs. concave will be present either way.

But if you are meaning “contour” as the external outline of the surface, then it seems like that would have to be solved by adding a boundary to the surface. In which case, you could try the Crop node from the Toolkit (see previous post).

Ok. I understand!
In french we call that “un faux ami”!
A contour in englis, is “courbe de niveau” in french
and a boundarie in english, is a “contour” in french!

So i agree with you, a contour and a horizontal breakline are the same things! but they’re not boundaries



 i have to improve my english!

thanks!

2 Likes

Ah OK, this is making much more sense now! Thank you for clarifying. So we have “French contours” and “English contours” :laughing:

1 Like