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?
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
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â
1 Like