• 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

TRACKTEXT LISP: Slide Text Along a Curve, Aligned to It

August 3, 2026

Pick a piece of text, pick a curve, and the text follows your cursor along that curve — always the right distance from it, always turned to match the curve’s direction at that exact point, always the right way up.

What TrackText does

This is the pipe label that has to sit above the pipe and run with it, the road name along a bend, the contour value on a contour, the flow arrow annotation on a duct. Placing one by hand means MOVE, then ROTATE with a reference angle picked off two points on the curve, then nudging it clear — and doing it again every time the curve is edited.

Anything the curve functions understand works as a track: lines, arcs, circles, ellipses, splines, polylines and xlines. The curve may be nested inside a block or an xref.

Controls: + and - change the offset, O types an exact one, < and > rotate 45°, R types an exact rotation, Y toggles readability, B toggles the background mask, Enter finishes.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Run TRACKSET once to choose the text type, justification, default offset, readability and whether to copy rather than move.
  3. Type TRACKTEXT.
  4. Pick the text, or type a new one. Pick the curve.
  5. Slide along the curve and click to place. In multiple text mode every click drops a copy and starts another.

How it works

The command runs inside a grread loop. On every mouse move the closest point on the curve to the cursor is found; the text is placed on the line from that point towards the cursor at a fixed distance — the offset factor multiplied by the text height; and it is rotated to that direction less ninety degrees, which lines it up along the curve rather than across it.

That middle step is what makes the behaviour feel right. The cursor chooses where along the curve and which side, but never how far away. Wave the mouse from one side of a pipe to the other and the label flips across, keeping its clearance.

Because the offset is a multiple of the text height rather than an absolute distance, it looks identical at any drawing scale.

Readability. Text aligned to a curve is upside-down for half of that curve. With readability on — the default — any angle that would put the text between 90° and 270° is rotated a further 180°, so it always reads left to right. Press Y to switch it off when you want the text to follow the curve literally.

Nested curves. The curve functions cannot measure an object inside a block reference, because its coordinates are in the block’s own space. So TrackText reads the transformation matrix nentselp returns, rebuilds a temporary copy of the curve in world coordinates, and tracks along that. The copy is stripped of its layer, colour, linetype and lineweight so it cannot disturb anything, and it is deleted when the command finishes — including if the command errors.

A polyline vertex needs special handling: picking one returns the vertex rather than the polyline, so the vertex’s owner is used instead.

Notes and limits

  • The offset is proportional to text height, so it looks right at any scale.
  • Readability is on by default. Press Y if you genuinely want text following the curve upside-down.
  • Nested and xref curves work, via a temporary world-space copy that is always cleaned up.
  • In multiple text mode the trailing uncommitted copy is removed when you press Enter.

Download and details

NameTrackText — slide text along a curve, aligned to it and the right way up
DownloadTrackText.lsp — 52.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsTRACKSET, TRACKTEXT
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 size52.2 KB, 1,219 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

  • TEXTRAIL LISP — aligning a whole group of text at once
  • CURVEHUG LISP — the same idea for symbols and blocks
  • SPANTAG LISP — labelling each object with its own length
  • 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