Last updated July 27, 2026
Block Count is a compact AutoLISP routine that tallies how many times each of your chosen blocks appears in the current drawing, then writes the totals out to a plain text file. According to the header in the source file, it was written by Gary Annable in May 1991 and freely donated to the Public Domain Software Market, which makes it one of the older utilities in our library and one of the easiest to understand.
It suits anyone who needs a quick quantity take-off of repeated symbols — valves, light fittings, furniture, section markers — without setting up AutoCAD’s data extraction tools. You tell it which block names you care about, run one command, and read the counts from the report file it leaves behind.
What it does in practice
The routine works from two lists. First it scans the drawing’s block table and gathers the name of every block defined in the file. Then it opens a text file called BLKTXT — a list you prepare beforehand, one block name per line — and reads in the names you actually want counted.
For each name that appears on both lists, BC steps through every entity in the drawing and counts the ones whose name field matches, which in practice means each insertion of that block is tallied. While it works, the command line shows “Counting blocks .” and prints a further dot for each block it processes, so you can see it has not stalled.
The results are not shown on screen. Instead the routine writes a report file named after the current drawing with a .TMP extension, in the folder AutoCAD is working from. Each line holds the block name — trimmed to eight characters, a habit from the DOS era it was written in — followed by the count.
One quirk worth knowing: because the match is made on the entity’s name field, an attribute whose tag happens to be identical to a listed block name will also be added to that block’s count. If you use attributed blocks, keep the tag names distinct from the block names on your list.
Command reference
The file defines a single command, BC, which counts the blocks listed in your BLKTXT file and writes the totals to the drawing-name .TMP report. There are no options or settings, and no prompts to answer.
How to load it
Extract BC.LSP from the BLC.zip download, then type APPLOAD in AutoCAD, browse to the file and click Load. If you plan to use it regularly, add it to the Startup Suite in the same dialog so it loads with every drawing session. For more background on loading and managing LISP files, see our AutoLISP programming guide.
Step-by-step usage
- Create a plain text file named BLKTXT — no extension — with one block name per line, typed exactly as the blocks are named in the drawing (the comparison is case-sensitive). The original convention was to finish the list with a line reading EOF, and the code still recognises it, though simply ending the file works too.
- Save BLKTXT in the current working folder. The routine opens the file by name alone, so it will not be found via AutoCAD’s support file search path. The .TMP report lands in the same folder, which is a handy way to confirm where that is.
- Load BC.LSP and type BC at the command line.
- Watch for “Counting blocks .” followed by a dot per block. When the dots stop, it is done.
- Open the report — the drawing name with .TMP added — in Notepad or any text editor.
Note that the routine has no error handling. If BLKTXT cannot be found it stops with an AutoLISP error rather than a friendly message, so check the file name and its location first if that happens. If you are curious how the file reading and writing is done, BC.LSP is a tidy real-world example of the techniques covered in Lesson 10 of our AutoLISP series, Input and Output.
Compatibility notes
This is pure AutoLISP — no DCL dialog files and no Express Tools functions — so nothing in it demands full AutoCAD. It should load on any full AutoCAD release, and in principle on AutoCAD LT 2024 or later, which added AutoLISP support. See what runs on AutoCAD LT for the details.
It was written for 1991-era AutoCAD, and two age-related quirks show. On current releases the DWGNAME system variable includes the .dwg extension, so expect the report to be named along the lines of Plan.dwg.TMP. And block names longer than eight characters are truncated in the report, although they are still counted correctly.
Download
| Name: | Block Count |
| Description: | Program to count specific blocks in a drawing. |
| Type: | AutoCAD AutoLISP Routine |
| Author: | Anon |
| File Size: | 2 Kb |
| Cost: | Free |
| Worked on: | AutoCAD |
| Download File: | BLC.zip |
Related routines
- Block Rename — a free routine for renaming blocks in a drawing.
- WBlock All — writes blocks out of a drawing to separate files.
- FixBlock — another free block utility from the routine library.