• 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

PTEXT LISP: Place Text Along a Polyline Path in AutoCAD

September 19, 2020

Last updated July 28, 2026

PTEXT places text along a polyline path. Draw the route you want the lettering to follow — a curve, a series of straight runs, whatever the drawing needs — and the text is set out along it rather than sitting on a single straight baseline.

It is by Viji Varghese of Kerala, India, dated March 1999.

A path is more flexible than an arc

Worth comparing with the arc text routine also on this site, which is the other way of getting curved lettering here.

That one works against an arc, so the text follows a constant radius and spreads across the whole arc. This one works against a polyline, which means the path can change direction, mix straight and curved segments, and be exactly the shape you drew rather than a circular approximation of it.

On a road name following a bend, a label tracking a services run, or lettering around an irregular boundary, that difference matters. On a simple curve the arc routine is quicker to set up.

It is careful with your settings

This is the part that stands out on reading the file, and it is unusual enough to be worth crediting.

Placing text along a path means changing a lot about the drawing environment temporarily — the current layer, the angle units, the angle direction, the angle base, command echo, point display mode, blip mode and the text style. This routine saves all eight and restores every one of them, and it does the restoring from inside its error handler as well as at the normal exit.

The practical consequence is that cancelling halfway through leaves your drawing exactly as it was. Compare that with several smaller routines in this library where an escape leaves command echo switched off, or your fillet radius at zero, with nothing to tell you.

The error handler also checks a marker before restoring anything, so it only acts when this routine was genuinely the one running — a refinement most authors do not bother with.

Command reference

The file defines a single command, PTEXT.

Note that the LLP Suite on this site also contains a file called ptext.lsp. If you have loaded that collection, whichever came last wins and you may not be running the routine you think you are. Load one or the other, or rename.

How to load it

Unzip Ptext.zip and load ptext.lsp with APPLOAD, or add it to the Startup Suite. No support files. Our AutoLISP guide covers loading.

Step-by-step usage

  1. Draw the polyline you want the text to follow, in the direction you want it to read.
  2. Set the text style and layer you want the result on.
  3. Type PTEXT.
  4. Select the path and follow the prompts for the text and its sizing.

Direction matters, as with any text-on-a-path tool: a polyline drawn right to left will give you text reading the wrong way. If the result is upside down, reverse the polyline and run it again.

Compatibility notes

March 1999, so written-for rather than tested-on, though the care taken over the drawing environment suggests code that was meant to last.

Plain AutoLISP with no dialog boxes and no Express Tools calls, so nothing requires the full product; LT users on LT 2024 or later, the release that brought AutoLISP to LT, should be able to run it. See what runs on AutoCAD LT. It adds text and does not modify the path, so nothing existing is at risk.

Download

Name: PTEXT
Description: Places text along any specified path(polyline)
Type: AutoCAD AutoLISP Routine
Author: Viji Varghese Kerala
File Size: 3 Kb
Cost: Free
Worked on: AutoCAD
Download File: Ptext.zip

Related routines

  • ATEXT — text along an arc, the simpler case.
  • TXP — turn the finished text into polylines.
  • CHGTEXT — match the height and style of the result to the rest of your annotation.

References

  • AutoLISP: the complete guide
  • Free LISP routines library
  • AutoLISP on AutoCAD LT

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