• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

POLY3D LISP: Lift a Flat Polyline Into Three Dimensions

August 6, 2026

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

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type POLY3D and pick the flat polyline.
  3. Choose where the heights come from — the existing elevation, a typed level, or vertex by vertex.
  4. Use POLYFLAT to 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

NamePolyTo3D — lift a flat polyline into 3D, and drop it back
DownloadPolyTo3D.lsp — 9.9 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsPOLY3D, POLYFLAT
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size9.9 KB, 264 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (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.
AuthorYZ, August 2026
LicenceFree 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

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in