• 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

AUTOTAG LISP: Keep AutoCAD Block Numbering in Sequence

August 3, 2026

Numbering that has to be maintained by hand is numbering that eventually has a gap in it. AUTOTAG watches a set of blocks and renumbers the whole sequence whenever one is added, copied or erased — so it is always complete and always in order.

What AutoTag does

Insert another block and it takes the next number. Delete one from the middle and everything after it closes up. Copy three and they number themselves. Nothing is renumbered by hand.

This is what you want for grid references, pile numbers, tree tags and sample points — anything where the sequence must stay complete and in order, and where a missing number is a real problem rather than a cosmetic one.

Two commands control it: AUTOTAGON enables automatic numbering, AUTOTAGOFF disables it. Numbering is also enabled on load if AutoTag:Startup is set, so putting the file in your acaddoc.lsp makes it permanent.

How to use it

  1. Configure it first — see the note below. It ships pointed at a block called myblock and a tag called mytag, which will match nothing in a real drawing.
  2. Load the routine with APPLOAD, or put it on your support file search path.
  3. Type AUTOTAGON to start watching.
  4. Work normally. Insert, copy and erase the blocks; the numbering keeps itself correct.
  5. Type AUTOTAGOFF to stop.

How it works

There are two reactors, and the reason is worth understanding. An object reactor watches the numbered blocks for erase, copy and unerase. But it fires during a command, while the drawing is mid-edit and the database is not settled — renumbering at that moment would be unsafe.

So the object reactor does not renumber. It creates a command reactor, which fires once the command has finished and the database is stable. That second reactor does the renumbering and then removes itself. The work is deferred to the first safe moment rather than done at the first possible one.

The object reactor is also detached while renumbering runs. Without that, the changes it makes would trigger it again and recurse indefinitely.

Undo is deliberately ignored. A flag records when the UNDO command is running and suppresses renumbering while it is. Without that, undoing a deletion would be immediately followed by a renumber — which is not what anyone means by undo.

Both the block name and the tag name accept wildcards, so “GRID*” matches every block whose name starts with GRID.

Notes and limits

  • Configure the settings block before using it. Out of the box it points at myblock and mytag and will match nothing. This is deliberate — it cannot start renumbering something in your drawing by accident.
  • Blocks are numbered in database order, which is the order they were created, not their position on the sheet. If you need left-to-right or along-a-path numbering, this is the wrong tool — use NUMINC instead.
  • Reactors live for the session. Use AutoTag:Startup and acaddoc.lsp to make it permanent.
  • Turn it off before bulk edits you do not want renumbered, then back on afterwards.

Download and details

NameAutoTag — keep an attribute automatically numbered as blocks change
DownloadAutoTag.lsp — 24.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsAUTOTAGOFF, AUTOTAGON
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size24.2 KB, 585 lines
Error handlingNone.
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

  • NUMSTAMP LISP — place incrementing numbers where you choose
  • ATTCLONE LISP — match the formatting of the numbered attributes
  • 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