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
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
WIDTHTRACEorWIDTHTRACEMANY. - 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
| Name | WidthTrace — convert a wide polyline into a closed outline of its edges |
| Download | WidthTrace.lsp — 15.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | WIDTHTRACE, WIDTHTRACEMANY |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com). |
| Source size | 15.0 KB, 385 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| 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
- 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