• 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

COUNTARRAY LISP: Array Objects and Increment the Numbers

August 3, 2026

Draw one parking bay labelled BAY 01, array it fifteen times, and an ordinary array gives you fifteen copies of BAY 01. COUNTARRAY gives you BAY 02 through BAY 16.

What CountArray does

The same applies to grid references, pile numbers, column marks, drainage manholes — anything that runs in sequence and would otherwise be renumbered by hand afterwards.

Two commands. COUNTARRAY is the standard one: fast, no preview. COUNTARRAYLIVE shows the array updating as you drag, but is noticeably slower because it rebuilds every copy on every mouse movement. Fine for a handful of objects, painful for hundreds.

What gets incremented: text, MText, attribute definitions, multileaders, dimension override text, and the attributes inside arrayed blocks.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type COUNTARRAY, or COUNTARRAYLIVE for a live preview.
  3. Give the increment. 1 is the default and is remembered between sessions; -1 counts down; 0.5 works too.
  4. Select the objects to array — anything except viewports.
  5. Pick a base point, then a second point defining the array vector. That vector sets both the direction and the spacing, so a shorter vector produces a denser array.
  6. Drag to set how far the array runs, and click.

How it works

Every number found anywhere in the text is incremented and the rest of the string is left alone. So BAY 01 OF 20 increments both figures — which is usually what you want on a sheet label, and is worth knowing about before you use it on text where it is not.

Leading zeros are preserved, so 007 becomes 008 rather than 8 — but only where the original actually had them. A plain 7 becomes 8, not 08. The routine matches what it found rather than imposing a format.

A note on the rounding, which matters more than it sounds. DIMZIN is forced to 0 during the operation and restored afterwards. Without that, repeatedly adding a value accumulates floating-point drift, and an array counting up in ones starts producing 44.0000001 somewhere in the forties. It is the sort of fault that appears only on long runs, which is exactly when nobody is checking every label.

Notes and limits

  • All numbers in the string increment, not just the first. Check your text before arraying something like TYPE 2 BAY 01.
  • COUNTARRAYLIVE rebuilds everything on every mouse move. Use the plain command for large selections.
  • The array vector sets the spacing, not just the direction. Pick the second point at the spacing you want.
  • Viewports cannot be arrayed. Everything else can.

Download and details

NameCountArray — array objects while incrementing the numbers in their text
DownloadCountArray.lsp — 20.3 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsCOUNTARRAY, COUNTARRAYLIVE
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size20.3 KB, 482 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

  • AUTOTAG LISP — numbering that maintains itself as blocks are added and erased
  • NUMSTAMP LISP — place incrementing numbers one at a time
  • 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