eplisp

Flatten / Set Z / Get Z (FLAT, CHZ, GETZ)

eplisp, the free multilingual LISP library

Flatten / Set Z / Get Z (FLAT, CHZ, GETZ)
Openly licensed; the original file is hosted here together with its license.
…
Rate this tool:
CommandsFLATCHZGETZ
CategoryCleanup and Files
AuthorMichael Flynn
Sourcemf4633/C3D-AutoCAD
LicenseMIT
Version1.1
Updated2026-05-20
RequirementsAutoCAD (including LT 2024 and later), BricsCAD and other CAD programs with AutoLISP. No Express Tools needed.
Prompt languageEnglish
Filesflatten.lsp (2 KB), chz.lsp (2 KB), getz.lsp (1 KB)
Added2026-10-26
Download the original fileSource repository

Three small elevation commands: FLAT sets selected objects to Z=0, CHZ moves them to a typed elevation, and GETZ reports the Z or elevation of one object.

These three commands come from Michael Flynn's Civil 3D/AutoCAD collection and target snap, intersection and dimension problems caused by objects sitting at stray elevations. They are especially useful for flattening 2D drawings imported from other programs.

Overview

FLAT sets the Z value of every 3D point in DXF groups 10–13 to 0 for the selected objects (or for the whole drawing if you press Enter without selecting), and zeroes LWPOLYLINE elevation (DXF 38) and thickness (DXF 39). CHZ writes the typed Z value into the same points and the LWPOLYLINE elevation; it does not touch thickness.

GETZ asks for one object and prints its elevation: DXF 38 for an LWPOLYLINE, otherwise the Z of its DXF 10 point. It does not change the drawing.

How to use it

  1. Load flatten.lsp, chz.lsp and getz.lsp with APPLOAD (or only the ones you need).
  2. To flatten, type FLAT and select objects, or press Enter straight away for the whole drawing.
  3. To move objects to an elevation, type CHZ, enter the new Z value and select the objects.
  4. To check an object's elevation, type GETZ and pick the object.

Notes and limitations

  • FLAT and CHZ modify objects directly; use U to undo. Pressing Enter in FLAT affects every object in the drawing, including paper space.
  • Legacy 3D polyline vertices, 3DFACE, mesh/surface objects and block contents are not processed; explode them first if needed.
  • CHZ also writes the Z value into DXF 11 groups that hold direction vectors (MTEXT direction, ELLIPSE major axis), which can distort those objects; use CHZ on lines, polylines, points, blocks and TEXT.
  • Objects on locked layers are skipped silently, but the reported count still includes every selected object.
  • For a LINE, GETZ reports only the Z of the start point.
  • The repository is new (2026); test the routine on a copy of the drawing first.

Source and license

This tool is not made by eplisp. The file is published unchanged under its author's license; copyright stays with the author.

References

  1. Source repository: mf4633/C3D-AutoCAD – https://github.com/mf4633/C3D-AutoCAD/tree/eeeda7b7b3ffe98917d4b2b3d329d6b84a966035
  2. Author: Michael Flynn – https://github.com/mf4633
  3. License: MIT – https://github.com/mf4633/C3D-AutoCAD/blob/eeeda7b7b3ffe98917d4b2b3d329d6b84a966035/LICENSE

Found a mistake, or are you the author of this tool? Request a correction or removal