• 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

TAGTINT LISP: Recolour Attribute Tags Inside AutoCAD Blocks

August 3, 2026

Making one field stand out on a drawing usually means editing every block that carries it. TAGTINT does the whole sheet in one go: select the blocks, tick the tags you want, pick a colour, and only those attributes change — every other attribute in the same blocks is left exactly as it was.

What TagTint does

The typical job is consistency. Every DOOR_REF on the sheet should read red; every ROOM_NAME should stay black. Doing that by hand across sixty door blocks is an afternoon and three missed ones. TAGTINT does it in one selection.

Select some attributed blocks and a dialog lists every distinct tag found across them — not every attribute, but each tag name once. Tick the ones you want, choose a colour, and the change is applied to matching attributes in every selected block.

The colour applies to the attribute itself, independently of the block it sits in. The block reference keeps its own colour, and so does every attribute you did not tick.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type TAGTINT.
  3. Select the attributed blocks. Only block references that actually carry attributes can be picked, and anything on a locked layer is skipped.
  4. The Attribute Tag Colour dialog opens, listing every distinct tag across the selection, sorted alphabetically.
  5. Tick one or more tags. The list is multi-select, and the first entry is pre-selected so OK is never meaningless.
  6. Click Select Colour or the colour swatch to open the standard AutoCAD colour dialog, and pick a colour.
  7. Click OK. The count of recoloured attributes prints at the command line.

How it works

The selection is filtered with (66 . 1), which restricts it to block references that carry attributes, and “_:L”, which excludes locked layers. Blocks with nothing to recolour cannot be picked in the first place.

Every attribute across the selection is then collected as a pair of tag name and attribute object. That pairing is the whole design: the tag names can be reduced to a distinct, sorted list for the dialog, while the objects themselves stay available to recolour once the user has chosen. Nothing has to be searched for twice.

Constant attributes are included. The ActiveX GetAttributes method returns only variable attributes, so GetConstantAttributes is called as well and the two lists joined. Without that second call, constant attributes would be invisible to the routine even though they are plainly visible in the drawing — a difference that is genuinely confusing when you hit it, because the tag you can see on screen simply does not appear in the list.

The dialog itself is written out to a temporary .dcl file at run time, loaded, used, and deleted immediately afterwards — including when you cancel. That keeps the routine a single self-contained file with no companion dialog file to install alongside it or lose. Every step of building the dialog is chained through one condition, so a failure at any point — disk full, no write permission on the temp folder, a syntax error in the DCL — drops straight to the cleanup rather than leaving a dialog handle open.

A multi-select list box returns its selection as a string of space-separated indices, such as “0 2 5”. Wrapping that in brackets and reading it converts it to a list of integers in one step, which are then mapped back to the tag names they point at:

(read (strcat “(” choice “)”))

The chosen colour is remembered between runs in a global, so repeated use does not mean re-picking the same colour every time. If you cancel the colour picker, the previous colour is kept rather than dropping to nil and failing later on.

The ActiveX selection set is deleted explicitly once the attributes have been collected. ActiveX selection sets persist in the document until removed, and leaving them behind is how a drawing ends up unable to create a new one.

Notes and limits

  • Attributes on locked layers are not touched. The selection filter excludes them, so a locked layer stays locked.
  • The colour is set on the attribute, not the block. Redefining or reinserting the block will not preserve it — this changes existing references in the current drawing.
  • Tags are matched by name across the whole selection. If two different blocks both use a tag called REF, ticking REF recolours it in both. That is usually the point, but it is worth knowing before selecting the whole sheet.
  • The whole operation is one undo group, so a single U puts every recoloured attribute back.

Download and details

NameTagTint — recolour chosen attribute tags across many blocks at once
DownloadTagTint.lsp — 10.3 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandTAGTINT
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com); nothing extra — the dialog is written to a temporary file at run time and deleted again, so there is no .dcl to install.
Source size10.3 KB, 250 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

  • UPDBLOCK LISP — change layer or colour inside block definitions
  • FixBlock LISP — reset block entities to layer 0
  • Block to BYLAYER LISP — reset block colours to BYLAYER
  • 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