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
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
;; 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
- 1Download and review the source code.
- 2Load the .lsp file with APPLOAD in a copy of a drawing.
- 3Keep the routine session-only until it has been tested for your CAD version and standards.
Command workflow
How to run the PTDIST command
- 1Run PTDIST.
- 2Pick the first point.
- 3Pick the second point and read both distances.
Worked example
Example: Check plan and sloped distance between two points.
- Run PTDIST.
- Pick both points.
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