Jump to content

Recommended Posts

Posted

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)
)

Posted

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)
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...