LENGTHTOTAG pushes a length — or the sum of several lengths — into a block attribute as a live field. Select the objects to measure, pick the attribute, and it is populated with a field showing the total. Editing the geometry updates the attribute automatically.
What LengthToTag does
This is the companion to AREATOTAG, for anything measured by run rather than by area: pipe lengths, kerb runs, cable routes, fence lines.
Pick either the attribute itself or anywhere on its block. A block with one attribute uses it without asking; one with several offers a list. Set LengthToTag:Tag to a tag name — LENGTH, say — and that attribute is used automatically whenever the picked block has one.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
LENGTHTOTAG. - Select the objects to measure.
- Pick the target attribute, or anywhere on the block containing it.
- Choose from the list if the block holds several attributes and no preset is configured.
How it works
A field must name the property it reads, and that name differs by object type:
Arc — ArcLength
Circle — Circumference
Line — Length
Polyline — Length
Asking a circle for its Length returns nothing at all — not an error, just an empty field. So the property is looked up from the object’s class name rather than assumed. That single lookup is what lets a mixed selection of lines, arcs and polylines sum correctly instead of silently dropping the arcs.
Notes and limits
- The block must already have an attribute to write into. This populates one; it does not add one.
- Constant attributes cannot hold a field — they live in the block definition rather than the insertion.
- Deleting a measured object breaks the field, which then shows
####. On a check set that is useful: a broken tag is visible, a stale typed number is not. - The result is in drawing units.
Download and details
| Name | LengthToTag — write a length into a block attribute as a live field |
| Download | LengthToTag.lsp — 13.9 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | LENGTHTOTAG |
| Requires | the 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 size | 13.9 KB, 340 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (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. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- AREATOTAG LISP — the same job for areas rather than lengths
- TAPE LISP — a one-off total at the command line instead of a field
- FOLLOWON LISP — select the whole run before measuring it
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program