What it does
Bearing Between Points with the PTBEARING AutoLISP command
Converts the planar angle between two points into a 0–360 degree azimuth measured clockwise from north.
- AutoLISP command
- PTBEARING
- Difficulty
- Intermediate
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 bearing-between-points.lsp AutoLISP code
;; CADLisp Tools - Bearing Between Points
(defun c:PTBEARING (/ p1 p2 degrees azimuth)
(if (and (setq p1 (getpoint "\nOccupied point: ")) (setq p2 (getpoint p1 "\nTarget point: ")) (/= (distance p1 p2) 0.0))
(progn
(setq degrees (* 180.0 (/ (angle p1 p2) pi)) azimuth (- 90.0 degrees))
(if (< azimuth 0.0) (setq azimuth (+ azimuth 360.0)))
(prompt (strcat "\nAzimuth clockwise from north: " (rtos azimuth 2 4) " degrees")))
(prompt "\nTwo different points are required."))
(princ))
Setup
How to install the bearing-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 PTBEARING command
- 1Run PTBEARING.
- 2Pick the occupied point.
- 3Pick the target point and read the azimuth.
Worked example
Example: Find the azimuth of a line between survey points.
- Run PTBEARING.
- Pick start then end.
A decimal-degree azimuth clockwise from north is printed.
Read before use
Notes and limitations
- Reports decimal-degree azimuth, not quadrant bearing.
- Uses the current UCS XY plane.
- Not manually CAD-tested.
Version history