• 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

AREATOTAG LISP: Put a Live Area Field Into a Block Attribute

August 3, 2026

A room tag that carries a typed area is wrong as soon as the wall moves, and nobody notices until the schedule is checked. AREATOTAG pushes the area — or the sum of several areas — into a block attribute as a live field, so the tag tells the truth by itself.

What AreaToTag does

Select the boundaries, then pick the attribute or the block that contains it, and the attribute is populated with a field showing the total area. Because it is a field rather than typed text, editing the boundary updates the attribute automatically.

This is how you build a room tag that stays correct: the room name is typed, the area is a field, and stretching the wall updates the tag without anyone having to remember to.

You can pick either the attribute itself or the block that holds it. If the block has exactly one attribute, that one is used without further prompting. If it has several, a list is shown to choose from — so you never have to zoom in far enough to click one specific attribute out of a crowded tag.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type AREATOTAG.
  3. Select the boundary or boundaries whose area you want.
  4. Pick the target attribute, or anywhere on the block containing it.
  5. If the block holds more than one attribute and no preset is configured, choose which one from the list.

How it works

The field written into the attribute is an object-property reference to the boundary’s Area, or an arithmetic expression summing several of them. Because the reference is to the object rather than to a number, the attribute re-evaluates whenever the drawing regenerates.

Presetting a tag skips the selection list. Set AreaToTag:Tag near the top of the file to an attribute tag name — “AREA”, say — and that attribute is used automatically whenever the picked block has one. Leave it nil to always be asked. On a project with a standard room tag, setting it once removes a prompt from every single use.

The number display is controlled by AreaToTag:Format: %lu6 for decimal linear units and %qf1 to suppress trailing zeros. Run FIELDSNOOP on a field whose appearance you like and it will report the code that produced it.

Notes and limits

  • The block must already have an attribute to write into. This populates an existing attribute; it does not add one.
  • Constant attributes cannot hold a field. They live in the block definition rather than the insertion, so there is nothing per-instance to write to.
  • The boundaries must be closed objects for AutoCAD to report an area.
  • Deleting a referenced boundary breaks the field, which then displays ####. That is a feature when checking a set — a broken tag is visible, whereas a typed number that has gone stale is not.

Download and details

NameAreaToTag — write an area into a block attribute as a live field
DownloadAreaToTag.lsp — 13.6 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandAREATOTAG
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 size13.6 KB, 328 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

  • AREASUM LISP — the same live total as MText or into a table cell
  • AREATABLE LISP — number areas and build a full schedule
  • TAGTINT LISP — recolour attribute tags across many blocks at once
  • 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