Lisp to display bearing and distance between two points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I have written a Lisp (shown below) that currently functions, and displays a distance between two points picked off of the screen, written in code as 'x1' and 'x2', and then applies a scale factor. I currently have to draw a line between two points, and select the line, and read the angle in the properties taskbar. I would like to be able to add a function to the lisp routine that in addition to displaying the distance, would also display a bearing (where the angle is measured from 'x1', North being 0°, and then in a clockwise direction to 'x2') in the command line. Any help would be greatly appreciated.
Thanks
Ahmed
(defun c:DM ()
(setq TD 0)
(setq x1 (getpoint "\nSelect First Point: "))
(setq x2 (getpoint x1 "\nSelect Second Point: "))
(prompt
(strcat
(rtos (distance x1 x2))
(rtos (setq TD (+ TD (/(distance x1 x2) 0.999848))))
)
)
(prompt (strcat "\nTotal Distance = " (rtos TD)))
(princ)
)
Thanks again