• 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

TAPE LISP: Total the Length of Any Selection in AutoCAD

August 3, 2026

Adding up lengths in AutoCAD is one of those jobs that looks like it should take five seconds and then does not. TAPE selects any mix of curves, adds up their true lengths, and prints the total — following every arc and spline curvature properly rather than measuring point to point.

What TapeMeasure does

Type TAPE, select objects, and the total length appears at the command line. Lines, arcs, circles, ellipses, splines and polylines are all handled, including polylines with bulged segments — the distance measured along the arc, not the straight line between the two vertices either side of it.

The result is formatted with rtos, which means it honours the drawing’s own LUNITS and LUPREC settings. If the drawing is set to four decimal places in millimetres, that is what you get back — the same units as everything else on the sheet, with no mental conversion.

It reads the drawing and changes nothing. There is no undo group because there is nothing to undo.

How to use it

  1. Load the routine with APPLOAD, or put it in a folder on your support file search path and load it from there.
  2. Type TAPE at the command line.
  3. Select the objects to measure. Anything that is not a measurable curve cannot be picked — see below for why that matters.
  4. Press Enter. The total prints at the command line.
Command: TAPE
Select objects to measure: 1 found
Select objects to measure: 12 found, 13 total
Select objects to measure:
Total length of 13 objects: 48620.5

How it works

Every curve in AutoCAD is internally parameterised: it runs from a start parameter to an end parameter, and the distance along it at any parameter can be queried directly. Asking for the distance at the end parameter therefore returns the whole length of the curve — correctly following every arc and every spline curvature on the way. That is the entire measurement, one call per object:

(vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))

The obvious alternative — and what a lot of older routines do — is to run the AREA command once per object and read the PERIMETER system variable back afterwards. That works, after a fashion, but it is slow across a large selection, it disturbs the active command state, and it returns nothing meaningful for an open spline. Querying the curve directly is exact for every supported type and touches no command state at all.

The measurement is wrapped in vl-catch-all-apply, because a degenerate object throws rather than politely returning zero. A zero-radius circle, a spline whose control points coincide, a polyline with a single vertex — these turn up in real drawings, usually inherited ones, and any of them would otherwise abort the count part way through. Catching each measurement individually means one bad object costs you that object, not the whole total.

Selection is filtered at the point of picking, with a filter of ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE. The wildcard catches POLYLINE, LWPOLYLINE and 3DPOLYLINE alike. Filtering at selection rather than testing afterwards is deliberate: an object with no length simply cannot be picked, which is far clearer than quietly scoring it zero and leaving you to wonder why the total looks low.

Anything that was selected but measured as zero is counted separately and reported. A clean run prints just the total; a run that hit a degenerate object always says so. A suspect number arrives with its own explanation attached rather than silently understating the answer.

Notes and limits

  • Only the listed types can be selected. Text, blocks, hatches and regions have no length to report and are excluded at the filter, so they cannot be picked by accident.
  • A circle or a closed polyline returns its full perimeter, not a partial arc. That is usually what you want when totalling; if it is not, break the object first.
  • Blocks are not looked inside. Curves nested in a block reference are not counted — explode first, or measure the source geometry.
  • The total is in drawing units. If the model is drawn at 1:1 in millimetres, so is the answer.

Download and details

NameTapeMeasure — total the length of every selected curve
DownloadTapeMeasure.lsp — 5.9 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandTAPE
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size5.9 KB, 150 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoNot needed — this routine only reads the drawing and changes nothing.
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

  • ZONE LISP — total polyline length or area by layer instead of by selection
  • Drawing scale chart — when the model units and the plotted size differ
  • 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