PDIST LISP: Distance Along a Polyline (Free AutoLISP Download)
PDIST measures the true distance along a polyline between two points that both lie on it, instead of the straight-line distance between them, without trimming, duplicating, or otherwise modifying the original polyline. It correctly handles polylines containing arc segments, and also labels each intermediate vertex-to-vertex segment length so you can cross-check the total.
PLDIST-bgol (Distance Along a Polyline)
Command Type: AutoLISP routine (works in AutoCAD, BricsCAD, ZWCAD and most AutoLISP-compatible CAD platforms)
Developed by: BGol Community, bgol.in
Inspired by the general concept of "distance along a path" measuring utilities used in survey and alignment drafting. This is an original, independently written routine, new file name, new command name, new source code, created so the CAD community has a free, editable, open-source alternative.
Overview
PDIST measures the true distance along a polyline between two points that both lie on it, instead of the straight-line distance between them, without trimming, duplicating, or otherwise modifying the original polyline. It correctly handles polylines containing arc segments, and also labels each intermediate vertex-to-vertex segment length so you can cross-check the total.
How to Use
- Load
PLDIST-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
PDISTat the command line and press Enter. - Select the polyline you want to measure along.
- Pick (or snap near) a Start Point and an End Point, they don't need to be actual vertices, any point along the polyline path works.
- The routine reports the total path distance between the two points, labels each individual segment length between intermediate vertices along that span, and places a total-distance label at the midpoint, all on layer
BGOL-PDIST.
Why Use It
- No trim-and-measure workaround, one command gives the true path distance directly, without duplicating or trimming the polyline.
- Handles arcs correctly, uses curve-parameter functions, so arc segments in the polyline are measured accurately, unlike a simple straight-line calculation.
- Built-in QA, per-segment length labels let you cross-check the total and see exactly which segment contributes what distance.
- Non-destructive, the original polyline is never modified.
Where to Use It
- Measuring chainage / distance along a survey alignment, breakline, or pipeline route between two arbitrary points.
- Verifying as-built lengths along a route without altering the original drawing geometry.
- Any land-survey or infrastructure drafting task needing "distance along a path" rather than "straight-line distance."
Notes
- Picked points are snapped to the nearest point on the curve via
vlax-curve-getClosestPointTo, so slightly off-curve picks still work. - Segment breakdown labels are placed at the midpoint of each vertex-to-vertex span that falls between the two picked points.
- Source code is fully open, feel free to study, modify, and redistribute it under the same open, free-for-all spirit.
Credits
Developed and shared for the CAD community by BGol Community. Website: https://bgol.in/ Free and open-source, use it, modify it, share it, for personal or commercial work alike.
Frequently Asked Questions
PDIST is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Picked points are snapped to the nearest point on the curve via vlax-curve-getClosestPointTo, so slightly off-curve picks still work.
No trim-and-measure workaround, one command gives the true path distance directly, without duplicating or trimming the polyline.
Yes. PDIST is fully open-source and free to use, modify, and redistribute for both personal and commercial work, developed and shared by the BGol Community.
Drag and drop PLDIST-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type PDIST at the command line to run it.
๐ค About BGol Community
BGol Community of Advanced Surveying builds and shares free, open-source tools for the survey and CAD drafting community.
๐ Made with โค๏ธ by BGol Community of Advanced Surveying
Free, open-source, and built for the CAD community, for personal or commercial use, always.