• 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

STATETALLY LISP: Count Dynamic Blocks by Visibility State

August 3, 2026

STATETALLY counts blocks — and, crucially, breaks dynamic blocks down by visibility state rather than lumping them together under one name.

What StateTally does

That is what makes it different from an ordinary block count. A single dynamic block definition called DOOR might appear in the drawing as single doors, double doors and fire doors, all sharing one block name. A plain count reports DOOR ... 47 and tells you nothing useful. This reports:

DOOR ................................. 47
  Single .............................. 31
  Double .............................. 12
  Fire ................................. 4

which is a schedule you can actually order from.

Results print to the text window and can be written to a TXT or CSV file, created alongside the drawing and named after it, then opened automatically.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Go to the layout you want counted — only the current one is included.
  3. Type STATETALLY.
  4. Read the breakdown, or send it to a TXT or CSV file.

How it works

Standard blocks and xrefs are counted normally. Only dynamic blocks that genuinely have a Visibility Parameter get the breakdown — a dynamic block with stretch or flip parameters but no visibility states is reported as one line, which is correct, because there is nothing to distinguish its instances by.

That distinction is what stops the report becoming noise. Breaking every dynamic block down regardless would produce a schedule full of one-line sub-entries that mean nothing.

Notes and limits

  • Only the current layout is counted — model space when in model space, the active sheet when in paper space.
  • Only blocks with a Visibility Parameter are broken down. Other dynamic blocks report as a single line.
  • The output file is named after the drawing and opens automatically.
  • It only reads the drawing, so there is no undo group.

Download and details

NameStateTally — count blocks by name and by visibility state
DownloadStateTally.lsp — 15.8 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandSTATETALLY
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size15.8 KB, 361 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

  • BLOCKTALLY LISP — a full schedule with block previews, drawing-wide
  • DEEPCOUNT LISP — counting that follows nesting
  • STRINGTALLY LISP — counting by label rather than by block name
  • 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