• 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

LAYERHARVEST LISP: Audit Layers Across a Folder of DWGs

August 3, 2026

LAYERHARVEST points at a folder, reads every drawing in it, and writes out the complete layer table of each one: name, colour, linetype, lineweight, plot flag, plot style, on, locked, frozen, frozen in new viewports, and description. No drawing is opened in the editor.

What LayerHarvest does

This is the tool for auditing a drawing set against a layer standard. Run it, open the result in Excel, sort by layer name, and every drawing that has strayed shows up immediately — the wrong colour on a dimension layer, a locked layer somebody forgot, a stray layer named Layer1.

The format is chosen by the extension you give the output file. .TXT gives a fixed-width report with columns padded to line up, and the padding character is selectable — spaces for reading on screen, tabs or commas for pasting elsewhere. .CSV opens directly in Excel. .XML can be structured XML, optionally with a stylesheet that makes it a formatted, colour-banded table in a browser, or SpreadsheetML, which Excel opens with one worksheet per drawing.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type LAYERHARVEST.
  3. Choose the folder of drawings.
  4. Tick the fields you want as columns.
  5. Give the output file a name, and choose the format by its extension.

How it works

Drawings are read through ObjectDBX, a database-only interface that loads a DWG file’s contents into memory with no editor window, no regeneration and no view to set up. A hundred files are read in the time it takes to open one.

Any drawing already open in this session is read through its live document object instead. Using ObjectDBX on a file that is already open would read the version on disk rather than the one on screen, and silently report stale data — which on an audit is worse than reporting nothing.

Which fields are extracted is a bit field. Each column has its own bit and the check boxes set or clear it. The extraction walks the same ordered list of accessor functions every time and keeps only the ones whose bit is set, so adding a column means adding one accessor and one check box — nothing else changes.

The CSV separator comes from your own Windows regional settings, so it imports cleanly everywhere rather than only where the comma is the list separator.

Notes and limits

  • Xref-dependent layers are excluded unless you tick the box. The ones with a vertical bar in their names belong to the referenced drawing, not this one, and would otherwise be reported twice.
  • True colours are reported as R,G,B; ACI colours as a plain number.
  • All settings persist, including the last folder and the output choices.
  • It only reads. No drawing is modified or saved.

Download and details

NameLayerHarvest — extract layer data from a whole folder of drawings
DownloadLayerHarvest.lsp — 54.8 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandLAYERHARVEST
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com); nothing extra — the dialog is written to a temporary file at run time and deleted again, so there is no .dcl to install.
Source size54.8 KB, 1,267 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoNot needed — this routine only reads the drawing and changes nothing.
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

  • BORROW LISP — import the correct layers once the audit shows what is missing
  • LAYERPILOT LISP — stop drawings straying from the standard in the first place
  • AIA and NCS layer format — the standard a set is often being audited against
  • 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