• 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

SPANTAG LISP: Label Every Object With Its Own Length

August 3, 2026

SPANTAG labels each selected object with its own length, as a live field placed at the object’s midpoint. Select a run of lines and polylines and every one is labelled, sitting on its own midpoint, rotated to run along the object.

What SpanTag does

Because the labels are fields rather than typed text, stretching the geometry updates every figure automatically. On a setting-out drawing that is the difference between a schedule that stays true and one that quietly stops being true the first time somebody adjusts a line.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Set the current text style and height — the labels use them.
  3. Type SPANTAG.
  4. Select the objects to label.

How it works

The right property is used per object type. A circle reports Circumference, an arc reports ArcLength, and everything else reports Length. Asking a circle for its Length would return nothing at all — not an error, an empty label — which is why the property name is chosen from the entity type rather than assumed.

Text stays readable. Labels are rotated to align with the object they measure, but any angle that would leave text upside-down is flipped through 180°. So a line running down-left reads left-to-right rather than being mirrored.

Each label is created with a background mask, so it stays legible where it sits on top of the line it is measuring. The current text style and height are used.

The number display is controlled by SpanTag:Format; %lu6 means decimal linear units. Run FIELDSNOOP on a field you like the look of to discover its code.

Notes and limits

  • The labels are fields, so they follow the geometry and update on regeneration.
  • Deleting a labelled object breaks its field, which then shows ####.
  • Set the text style and height first. The labels take the current ones.
  • Masked labels obey draw order like any other mask.

Download and details

NameSpanTag — label objects with their length, as a live field at the midpoint
DownloadSpanTag.lsp — 11.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandSPANTAG
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size11.2 KB, 280 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

  • LENGTHTOTAG LISP — a total pushed into a block attribute instead
  • SEGREPORT LISP — every segment of one polyline as a schedule
  • FIELDSNOOP LISP — find the formatting code you want
  • 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