• 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

ZONE LISP: Total Polyline Area or Length by Layer in AutoCAD

September 19, 2020

Last updated July 28, 2026

ZONE answers a question that comes up constantly on planning and civil drawings: what is the total area of everything on this layer? You pick any object on the layer you care about, choose area or length, and it finds every polyline on that layer in the drawing and gives you the total.

It is by David Bethel, dated May 2004, and the header credits the original idea to David Watson. For a routine of thirty lines it is unusually well thought out — it declares all its variables properly, and it reports one thing most area totals leave out, which is covered below.

What it does in practice

You do not tell it a layer name. You point at an object, and it takes the layer from whatever you picked. That is a good deal faster than typing a layer name, and it removes the chance of a typo returning zero.

It then builds a fresh selection of every polyline on that layer and steps through them, handing each to AutoCAD’s own AREA command and reading back either the area or the perimeter. Because it uses AutoCAD to do the measuring rather than working through the vertices itself, the numbers match what you would get measuring by hand, and arc segments in a polyline are handled correctly.

Both polyline types are covered. The filter uses a wildcard that matches the older heavyweight POLYLINE and the lightweight LWPOLYLINE that AutoCAD has produced by default since Release 14, so nothing is silently skipped — a trap that catches several other routines of this vintage.

The open polyline count, and why it matters

When you ask for area, the report ends with a count of how many of the polylines were open rather than closed. That is not padding. AutoCAD will happily give you an area for an open polyline by pretending a line runs from the last vertex back to the first — so an open boundary still returns a number, and the number is for a shape you did not draw.

If that count comes back as zero, your total is trustworthy. If it does not, some of the figures in your total are assumptions. Close the offending polylines and run it again. Very few free area routines tell you this, and on a planning drawing where the area total ends up in a submission it is the difference between a number you can sign off and one you cannot. The count is only reported for area, not length, because an open polyline’s perimeter is a perfectly meaningful figure.

One thing to watch

The search covers the whole drawing database, not just what you can see. Polylines on that layer will be counted whether the layer is frozen or off, and whether they sit in model space or in a layout. That is usually what you want. It is not what you want if you keep a copy of a boundary on the same layer in a sheet layout, so check the polyline count in the report against what you expect.

Command reference

The file defines a single command, ZONE.

How to load it

Unzip Zone.zip and load zone.lsp with APPLOAD, or add it to the Startup Suite. There are no support files. Our AutoLISP guide covers loading if it is new to you.

Step-by-step usage

  1. Type ZONE.
  2. At “Pick any object on the required layer”, select one object. It only reads the layer from your pick, so any object on that layer will do.
  3. At “Would you like to measure Length/<Area> :” press Enter for area, or type L for length.
  4. It reports the total for the layer, the number of polylines it measured, and — for an area run — how many of them were open.

The figure comes back in drawing units, so on a metric site plan drawn in millimetres an area arrives in square millimetres. Divide accordingly, or draw in metres if areas are what the drawing is for.

Compatibility notes

Dated 2004, so written-for rather than tested-on, though it uses nothing that has changed since. It is plain AutoLISP with no dialog boxes and no Express Tools calls, driving AutoCAD’s own AREA command, so nothing in it requires the full product; LT users on LT 2024 or later, the release that brought AutoLISP to LT, should be able to run it. See what runs on AutoCAD LT. It only reads the drawing and writes nothing, so it is safe to try on live work.

Download

Name: ZONE
Description: A command that will give a total area or length for all polylines on a specified layer.
Type: AutoCAD AutoLISP Routine
Author: David Bethel
File Size: 1 Kb
Cost: Free
Worked on: AutoCAD
Download File: Zone.zip

Related routines

  • ADDLENGTH — totals lengths from a selection rather than a layer, though it misses lightweight polylines.
  • Join 2 Polylines — close up a boundary before you measure its area.
  • COGO bearing and distance label — annotate the boundary once you have the numbers.

References

  • AutoLISP: the complete guide
  • Free LISP routines library
  • AutoLISP on AutoCAD LT

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