LISP2LEARN Posted July 13, 2011 Posted July 13, 2011 I'm scratching my head over this. How can I round it down to the nearest feet? I just need to remove the inches. Thanks. (defun C:test (/) (defun LM:Round ( n ) (fix (- n (if (minusp n) -0.5 0.5)))) (setq pt1 (getpoint "\n Pick first point:" )) (setq pt2 (getpoint "\n Pick second point:")) (command ".dist" pt1 pt2 ) (setq #dist (rtos (lm:round (getvar 'distance)))) (princ #dist) (princ) ) Quote
Lee Mac Posted July 13, 2011 Posted July 13, 2011 To always round down, maybe: (fix (/ (distance p1 p2) 12.0)) (defun c:test ( / p1 p2 ) (if (and (setq p1 (getpoint "\nFirst Point: ")) (setq p2 (getpoint "\nSecond Point: " p1)) ) (princ (strcat (itoa (fix (/ (distance p1 p2) 12.0))) "'")) ) (princ) ) 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.