surveyscad2018 Posted February 28, 2018 Posted February 28, 2018 (edited) Hi I have written a Lisp routine (shown below) that measures the distance between two points, and applies a scale factor that is written within the lisp, and displays it within the command line. Although the lisp functions, it may not be the 'cleanest'. I was wondering if it was possible to add a function to the lisp that in addition to displaying the newly calculated distance, will display a bearing. ideally, the bearing displayed would be written in a Degrees Minutes Seconds format, and not directional bearings (Ex. N73°25'45"W would be displayed as 286°34'15"). In the language of the lisp I have written, from 'x1', North is 0°, and the angle is turned clockwise from north, to a line drawn between 'x1' and 'x2'. Any help would be great. If anyone has a lisp that already does this, or can amend my lisp to do it, that would be perfect. Thanks Ahmed ;Use this command to measure the distance between two points while applying a Combined Scale Factor ;Be sure to copy this lisp to your job folder, and set your CSF as required. Do not change CSF outside of job folder. ;Ahmed F. 2017 (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. Edited March 1, 2018 by SLW210 Added Code Tags! Quote
hanhphuc Posted March 1, 2018 Posted March 1, 2018 Hi ideally, the bearing displayed would be written in a Degrees Minutes Seconds format, and not directional bearings (Ex. N73°25'45"W would be displayed as 286°34'15".. try this (hp:deg->dms (angle x1 x2)) old thread Quote
BIGAL Posted March 1, 2018 Posted March 1, 2018 (edited) Try this (SETVAR "ANGBASE" (/ pi 2)) (SETVAR "ANGDIR" 1) (SETVAR "AUNITS" 0) (while (setq pt1 (getpoint "pt1")) (setq pt2 (getpoint "pt2")) (princ "\n") (princ (angtos (angle pt1 pt2) 1 )) (princ "\n") ) Edited March 1, 2018 by BIGAL Quote
sanjeeve Posted March 1, 2018 Posted March 1, 2018 Hi I have written a Lisp routine (shown below) that measures the distance between two points, and applies a scale factor that is written within the lisp, and displays it within the command line. Although the lisp functions, it may not be the 'cleanest'. I was wondering if it was possible to add a function to the lisp that in addition to displaying the newly calculated distance, will display a bearing. ideally, the bearing displayed would be written in a Degrees Minutes Seconds format, and not directional bearings (Ex. N73°25'45"W would be displayed as 286°34'15"). In the language of the lisp I have written, from 'x1', North is 0°, and the angle is turned clockwise from north, to a line drawn between 'x1' and 'x2'. Any help would be great. If anyone has a lisp that already does this, or can amend my lisp to do it, that would be perfect. Thanks Ahmed ;Use this command to measure the distance between two points while applying a Combined Scale Factor ;Be sure to copy this lisp to your job folder, and set your CSF as required. Do not change CSF outside of job folder. ;Ahmed F. 2017 (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. you can get this lisp from microsurvey Quote
SLW210 Posted March 1, 2018 Posted March 1, 2018 Please read the Code Posting Guidelines and have your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.