• 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

WIDTHTRACE LISP: Turn a Wide Polyline Into a Real Outline

August 3, 2026

A polyline with width is drawn as a thick line, but it is still stored as a single centreline with width values. Anything that needs the real shape — hatching the road surface, exporting the kerb face, trimming to the edge of a duct — needs that thickness expressed as actual geometry. WIDTHTRACE traces the visible edges and creates a genuine closed polyline around them.

What WidthTrace does

WIDTHTRACE outlines one polyline; WIDTHTRACEMANY outlines a whole selection. Varying width along the run is handled.

An open source polyline yields one closed outline; a closed source yields two — an outer and an inner — since the shape is then a ring.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type WIDTHTRACE or WIDTHTRACEMANY.
  3. Select the wide polylines. Any containing an arc segment cannot be picked — see below.

How it works

For each segment the unit normal is computed — the direction square to it — and the segment’s two endpoints are offset along that normal by half the width at each end. Done once with plus and once with minus, that yields the left and right edge lines of the segment.

Where two consecutive segments meet, their edge lines are intersected. That intersection is the true mitred corner of the outline — not an approximation, and not a gap.

Finally the left edge run is joined to the reversed right edge run to close the loop.

Notes and limits

  • Straight segments only, and this is deliberate. The selection filter rejects any polyline containing a bulged segment, because the edge of a variable-width arc is not itself an arc — it is a spiral — and cannot be represented by polyline geometry without approximation. Rather than silently producing subtly wrong output, such polylines simply cannot be selected.
  • A closed source gives two outlines, outer and inner.
  • The source polyline is left in place.
  • One undo group covers the run.

Download and details

NameWidthTrace — convert a wide polyline into a closed outline of its edges
DownloadWidthTrace.lsp — 15.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsWIDTHTRACE, WIDTHTRACEMANY
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size15.0 KB, 385 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

  • VERTINJECT LISP — adding vertices while preserving width and bulge
  • SHRINKWRAP LISP — outlining any selection, including arcs
  • SEGREPORT LISP — report the widths a polyline actually carries
  • 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