POLY3D converts a flat polyline into a 3D polyline, so its vertices can be given individual heights. POLYFLAT goes the other way, dropping a 3D polyline back to one level.
What PolyTo3D does
A contour traced flat can be lifted to its level. A drainage run can be given falls. A road centreline can take a vertical alignment. None of that is possible while it is a lightweight polyline, which has one elevation for the whole object and no way to vary it.
Heights can come from the polyline’s own elevation, from a level you type, or by picking each vertex in turn.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
POLY3Dand pick the flat polyline. - Choose where the heights come from — the existing elevation, a typed level, or vertex by vertex.
- Use
POLYFLATto drop a 3D polyline back to one level.
How it works
There is no AutoCAD command for this, and there is a reason. A lightweight polyline and a 3D polyline are different object types with different structures — the first stores 2D points and one elevation, the second stores a chain of 3D vertices.
One cannot become the other. A new object has to be built from the old one’s points, which is what this does.
Bulges are lost in the conversion, because a 3D polyline has no arcs. Any curved segment is reported and drawn as a straight chord — reported being the important half, since a silently straightened contour is a contour that is now wrong.
Notes and limits
- Curved segments become straight chords, and are reported. Add vertices first if the curve matters.
- A 3D polyline cannot be given width either — that is the object type, not the routine.
- POLYFLAT discards the height variation, which is the point, but it is not reversible.
- One undo group covers the conversion.
Download and details
| Name | PolyTo3D — lift a flat polyline into 3D, and drop it back |
| Download | PolyTo3D.lsp — 9.9 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | POLY3D, POLYFLAT |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com). |
| Source size | 9.9 KB, 264 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- PTIMPORT LISP — building the polyline from a coordinate file
- VERTINJECT LISP — adding vertices before converting
- INTERP LISP — working out the contour levels in the first place
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program