Last updated July 28, 2026
This one needs a correction before anything else. The listing below describes ZP as a routine that “sets all lines to zero elevation”. The file inside the download does nothing of the sort. It works on blocks rather than lines, it does not flatten anything to zero, and it writes a coordinate file as it goes. The description has been attached to this download for years, so if you came here expecting a flatten tool, you want a different routine.
What you actually get is a small survey utility: it reads a level value out of each block’s first attribute, pushes that value into the block’s Z coordinate, and exports a tab-separated list of point number, X, Y and elevation to a text file you name. For anyone working with levelled point blocks — survey pickups, spot heights, pit lids — that is a useful thing to have. It just is not what the label says.
What it does in practice
Run the command and it asks for a file name, then for the point number to start counting from, then for two corners of a crossing window. It collects every block insertion inside that window and steps through them one at a time.
For each block it looks at the entity immediately following the insertion. If that entity is an attribute, the routine takes the attribute’s text, converts it to a number with atof, and writes that number into the Z coordinate of both the attribute and the block insertion point. So a point block whose first attribute reads 24.315 ends up sitting at Z = 24.315 instead of on the zero plane. Then, block by block, it writes a line to the text file: point number, X to three decimals, Y to three decimals, and the elevation.
The file it produces opens with the line “Exported coordinates:-” and a header row reading POINT, X, Y, ELEV, with tabs between the columns so it drops straight into a spreadsheet. The point numbering runs on from whatever start value you gave it, one per block.
It will not run as downloaded
The code calls a helper function named DXF five times, and that function is not defined anywhere in the file, nor is it part of AutoLISP. Load zp.lsp on its own and the first block it reaches will stop with “no function definition: DXF”.
DXF is a very common one-line convenience wrapper that pulls a value out of an entity’s association list, and the author clearly had it loaded from elsewhere in their own setup. Add this line above the routine and the file works:
(defun dxf (code elist) (cdr (assoc code elist)))
That is the same assoc and cdr pairing the routine already uses directly a few lines earlier, so nothing about the behaviour changes — it simply supplies the shorthand the rest of the file expects. If association lists are unfamiliar, Lesson 9 on data structures covers the pattern.
Command reference
The file defines one command, and it is not called ZP. It is ZP2, despite the download being named Zp1.zip and the listing calling it ZP. Type ZP2 after loading.
How to load it
Unzip Zp1.zip to get zp.lsp, add the dxf definition described above, then load the file with APPLOAD. Because it writes a file into whatever directory AutoCAD considers current, check where that is before you run it if you want to find the output afterwards. There is a general walkthrough of loading routines in our AutoLISP guide.
Step-by-step usage
- Type ZP2.
- At “Enter name of TEXT file to create:” type a name without an extension — the routine appends .txt itself.
- At the point reference prompt, enter the number the listing should start at. The default shown is 1 the first time, and afterwards whatever you last used.
- Pick the bottom left and then the top right corner of the area to process. Only block insertions inside the crossing window are collected.
- The routine works through the blocks silently and closes the file when it finishes.
Two things to watch. It modifies your drawing as well as writing the file — block insertion points move in Z — so run it on a copy the first time. And a block whose first attribute holds text that is not a number converts to 0.0 through atof, which will quietly drop that point to zero elevation rather than reporting a problem.
Compatibility notes
The file carries no date or author. It is plain AutoLISP — no dialog boxes, no Express Tools calls — using selection sets, entity access and file output that have been in the language for decades, so there is nothing in it that demands full AutoCAD. AutoCAD LT gained AutoLISP in LT 2024, so LT users on 2024 or later should be able to run it once the missing dxf helper is supplied; see what runs on AutoCAD LT. We have not tested it on current releases, and given that it edits geometry and writes files, a copy of your drawing is the right place to start.
Download
| Name: | ZP |
| Description: | sets all lines to zero elevation |
| Type: | AutoCAD AutoLISP Routine |
| Author: | Anon |
| File Size: | 1 Kb |
| Cost: | Free |
| Worked on: | AutoCAD |
| Download File: | Zp1.zip |
The description in this table is the one the file has carried since it was collected, and it is repeated here unchanged so the listing matches the download. As set out above, it does not describe what the code does.
Related routines
- ImportXYZ — the reverse trip: reads a coordinate file and places points, blocks or notes in the drawing.
- COGO bearing and distance label — labelling boundary lines without a survey package.
- Best of LISP collection — includes a pair of flatten routines, which is what the ZP listing sounds like it promises.