CADLisp Tools

Geometry & Polylines

Distance Between Points AutoLISP routine

Report the 2D and 3D distance between two picked points. Download the .LSP source below and run the PTDIST command after loading it.

⌘ PTDISTv1.0.0BeginnerUpdated Sep 18, 2026

What it does

Distance Between Points with the PTDIST AutoLISP command

Prompts for two points, calculates planar and spatial distances, and prints both values without modifying the drawing.

AutoLISP command
PTDIST
Difficulty
Beginner

Applicable disciplines

CAD workflows that use this routine

Requirements and compatibility

What it needs

AutoLISP

Software rows marked “Not tested” are not compatibility claims. Test the routine in a copy of your drawing and CAD version.

Downloadable source code

Review the distance-between-points.lsp AutoLISP code

distance-between-points.lspAUTOLISP
;; CADLisp Tools - Distance Between Points
(defun c:PTDIST (/ p1 p2 planar spatial)
  (if (and (setq p1 (getpoint "\nFirst point: ")) (setq p2 (getpoint p1 "\nSecond point: ")))
    (progn
      (setq planar (distance (list (car p1) (cadr p1)) (list (car p2) (cadr p2))) spatial (distance p1 p2))
      (prompt (strcat "\n2D distance: " (rtos planar 2 3) "; 3D distance: " (rtos spatial 2 3)))))
  (princ))

Setup

How to install the distance-between-points.lsp file

  1. 1Download and review the source code.
  2. 2Load the .lsp file with APPLOAD in a copy of a drawing.
  3. 3Keep the routine session-only until it has been tested for your CAD version and standards.

Command workflow

How to run the PTDIST command

  1. 1Run PTDIST.
  2. 2Pick the first point.
  3. 3Pick the second point and read both distances.

Worked example

Example: Check plan and sloped distance between two points.

  1. Run PTDIST.
  2. Pick both points.
Expected result

The command line reports 2D and 3D distances.

Read before use

Notes and limitations

  • Uses current drawing units.
  • Does not create a dimension.
  • Not manually CAD-tested.

Version history

Changelog

v1.0.0Sep 18, 2026Initial read-only point measurement.

Keep automating

Related tools

Geometry & Polylines3 disciplines

Bearing Between Points

Report clockwise azimuth from north between two picked points.

⌘ PTBEARINGIntermediateCAD support: not tested
Updated Sep 18, 2026VIEW TOOL →
Dimensions & Annotation6 disciplines

Coordinate Label X/Y

Create a WCS X/Y text label at a picked coordinate.

⌘ XYLABELBeginnerCAD support: not tested
Updated Sep 18, 2026VIEW TOOL →
Geometry & Polylines4 disciplines

Station/Chainage Along Polyline

Report distance along a selected polyline to a picked location.

⌘ CHAINAGEIntermediateCAD support: not tested
Updated Sep 18, 2026VIEW TOOL →