How to define the elevation of 2D polylines? #427
-
I have a shp file with a lot of contours inside and for each of them a fixed elevation, which is looking something like this: Each line inside has elev property. I want to convert this shape lines into dxf, using Polyline2D with elevation for each contour line. I have put in an array of tupples [(x, y, z)] and used
which is giving the lines correctly but I still don't have elevation when viewing the dxf on AutoCAD. I am guessing I need to add an field for each polyline named Elevation, but I don't know how to do that. Note: I can't use Polyline3D. Any help will be much appreciated. Sorry If my post is correctly structured. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can define the elevation as vertex, strange - but that is the requirement of the DXF format: z = 10 # same z-axis for all vertices
msp.add_polyline2d(contour_plgs, format='v', dxfattibs={
"elevation": (0, 0, z),
}) LWPOLYLINE has a proper elevation attribute: z = 10 # same z-axis for all vertices
msp.add_lwpolyline(contour_plgs, format='v', dxfattibs={
"elevation": z,
}) Other solution: translate entity in z-direction: z = 10 # same z-axis for all vertices
entity = msp.add_polyline2d(contour_plgs, format='v')
entity.translate(0, 0, z) |
Beta Was this translation helpful? Give feedback.
You can define the elevation as vertex, strange - but that is the requirement of the DXF format:
LWPOLYLINE has a proper elevation attribute:
Other solution: translate entity in z-direction: