Select a scattered group of Text or MText objects, then drag: the whole group snaps into line and follows the cursor live. Release, and it is done. TEXTRAIL has no dialog, no repeated MOVE, and no guessing — you see the final arrangement before you commit to it.
What TextRail does
Straight-line modes line the text up on an invisible rail you drag out with the cursor. Horizontal slides each item sideways onto the rail, keeping its own height — for left-aligning a ragged column. Vertical slides each up or down, keeping its horizontal position — for levelling a ragged row. Stretch spreads the items evenly between the anchor point and the cursor, so the group stretches or compresses like a concertina.
Curve mode strings the text along any curved object you pick — polyline, arc, circle, spline, ellipse, line or xline — with spacing, offset and rotation to the tangent all adjustable live.
Live controls in straight-line mode: TAB cycles the mode, S sets a fixed spacing, R types an exact rotation, J changes justification, O switches to curve mode, C cycles the guide colour, F8 toggles ortho, click accepts, Escape cancels.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
TEXTRAIL. - Select the text objects.
- Drag to set the rail. Press
TABto cycle horizontal, vertical and stretch. - Press
Oand pick a curve to string the text along it instead;Ereturns to straight-line mode. - Click to accept, or Escape to put everything back.
How it works
The whole command runs inside a grread loop, which reports every mouse move and keystroke without ending. On each move it reads the cursor, computes where every selected object should now sit, writes those positions straight to the objects through ActiveX, and draws a rubber-band vector so the rail is visible.
Because it modifies the real objects rather than drawing a preview, what you see during the drag is the result. The consequence is that cancelling has to actively undo the changes — which is exactly what the error handler does, restoring every object’s saved position and rotation before it exits.
Justification-aware positioning. Text objects have two possible position properties and using the wrong one produces text that jumps unpredictably: InsertionPoint is meaningful only for left-justified Text, TextAlignmentPoint for every other justification. MText always uses InsertionPoint but interprets it relative to its AttachmentPoint.
TextRail inspects each object once and remembers which property to drive, so a mixed selection of centred, right-aligned and middle-justified text all behaves correctly.
Notes and limits
- Escape genuinely puts everything back. The objects really moved during the drag, so the error handler restores every saved position and rotation.
- ORTHOMODE is deliberately not restored on exit. Pressing
F8during the command is a real user decision and behaves exactly as it does in any native AutoCAD command. - SHIFT detection needs Express Tools. Without it the program still runs; only the shift-to-rotate shortcut is unavailable, and
Rcovers the same ground. - Mixed justifications are handled, which is where simpler alignment routines fail.
Download and details
| Name | TextRail — align selected text dynamically, by dragging |
| Download | TextRail.lsp — 70.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | TEXTRAIL |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com). |
| Source size | 70.2 KB, 1,356 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | Not needed — this routine only reads the drawing and changes nothing. |
| 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
- TEXTRANK LISP — align and equispace single-line text without dragging
- CURVEHUG LISP — the same idea for symbols rather than text
- TEXTCLONE LISP — match the formatting once the positions are right
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program