• 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

STRINGTALLY LISP: Count Text Occurrences Into a Table

August 3, 2026

STRINGTALLY counts how many times each distinct piece of text appears in a selection, and builds the result as a real AutoCAD table object in the drawing.

What StringTally does

Select everything annotated and you get a schedule: each unique string, and how many of them there are. Useful for counting door types, drainage symbols and fitting references — anything identified by its label rather than by its block name.

What it reads. Text and MText contribute their content. A multileader contributes its text. Attributed blocks contribute every attribute value, summed across the block.

Dimensions contribute only where the text has been manually overridden, since a measured dimension is not a label — counting them would fill the schedule with distances.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Set the table style you want — the result uses the current one.
  3. Type STRINGTALLY.
  4. Select the annotation to count.
  5. Pick an insertion point for the table.

How it works

MText longer than 250 characters is split by AutoCAD across several DXF entries, so groups 1 and 3 are concatenated to recover the whole string. Without that, a long note would be counted as a fragment, and two notes differing only past the 250th character would count as the same thing.

The table uses the current table style and is sized from that style’s own text height, so it matches the rest of the drawing’s tables rather than arriving at some arbitrary size.

Annotative text styles are handled by dividing through by the current annotation scale, so the table comes out right on an annotative drawing instead of being scaled twice.

Notes and limits

  • Measured dimensions are not counted, only overridden ones — a deliberate distinction.
  • Matching is exact. A trailing space or a different case makes two entries where you wanted one.
  • Set the table style first. The result inherits it.
  • One undo group covers the table.

Download and details

NameStringTally — count how often each distinct piece of text appears
DownloadStringTally.lsp — 11.6 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandSTRINGTALLY
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size11.6 KB, 297 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
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

  • STATETALLY LISP — counting dynamic blocks by visibility state
  • BLOCKTALLY LISP — counting by block name, with previews
  • WORDSWAP LISP — find and replace across the text you have just counted
  • 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