• 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

WHEREUSED LISP: Find What Is Blocking a Purge

August 6, 2026

WHEREUSED answers the question PURGE never will: why can I not get rid of this? You try to purge a layer, a text style, a linetype or a block, AutoCAD refuses, and nothing on screen appears to be using it. This finds what is, and tells you exactly where.

What WhereUsed does

Every block definition in the drawing, model space and every paper space layout included — they are all block definitions underneath, so one sweep of the block table covers the lot. That catches the usual culprit: a stray object on the layer inside a block nobody has opened for years.

Then the references that are not objects at all, and which are what normally defeats people:

- a LINETYPE assigned to a LAYER definition, even an empty one
- a TEXT STYLE named by a DIMENSION STYLE as its text font
- a BLOCK named by a DIMENSION STYLE as a custom arrowhead
- anything that is the CURRENT layer, style, linetype or dimstyle

None of those show up when you look at the drawing, which is exactly why they are so annoying.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type WHEREUSED.
  3. Choose layer, style, linetype or block, and name the one you cannot purge.
  4. Read the report.

How it works

A missing DXF group is not a mismatch. The original compared the wanted name against a group read straight off each entity, and neither group 6 nor group 7 is present on most objects — linetype is omitted when it is BYLAYER, and text style only appears on text.

Comparing a string with the resulting nil is a bad argument type, so the search stopped on the first ordinary line it met. Only Layer and Block ever worked; Linetype and Style crashed every time.

It counts rather than stopping at the first match inside each block, so the report says how much of it there is, not just that there is some.

The mline style dictionary is read per run, not computed once at load time into a global — otherwise a drawing opened later in the session is searched against the wrong dictionary.

Progress is reported without backspacing over itself. Printing a block name and then rubbing it out with a character counter leaves the tail of the longest name on screen whenever a shorter one follows.

Notes and limits

  • Four kinds of item: layer, text style, linetype, block.
  • It looks at table entries too, which is where the hard cases live.
  • Nothing is changed — it only reports.
  • Run it before PURGE, not after.

Download and details

NameWhereUsed — find what is still using a layer, style, linetype or block
DownloadWhereUsed.lsp — 12.5 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandWHEREUSED
Requiresnothing beyond a CAD platform with AutoLISP.
Source size12.5 KB, 272 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

  • BLOCKPURGE LISP — removing a block and everything that references it
  • STRAYHUNT LISP — finding objects that should not be there
  • LAYERHARVEST LISP — auditing what layers are actually in use
  • 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