Jump to content

X distance


FazBear

Recommended Posts

(defun c:test ()
 (setq p1 (getpoint "Pick first point: ")
   p1x (car p1)
     p2x (car (getpoint "Pick second point: " p1))
   xdist (abs (- p1x p2x))
   )
(alert (strcat "The X distance between the two points is " (rtos xdist 2 2) "\nand is saved in the variable Xdist"))
(princ)
)

Link to comment
Share on other sites

Ended up using ASMI's method, just tweaked it to a more simple format (for me to understand).

 

Thanks again!

 

 

(defun c:signage ()

 

(setq POINT1 (getpoint "Pick Top Left: "))

(setq POINT2 (getpoint POINT1 "Pick Bottom Right Corner: "))

(setq POINT1X (car POINT1))

(setq POINT2X (car POINT2))

(setq XDIST (- POINT2X POINT1X))

(setq POINT1Y (cadr POINT1))

(setq POINT2Y (cadr POINT2))

(setq YDIST (- POINT1Y POINT2Y))

 

(alert (strcat "The X distance between the two points is "(rtos XDIST 2 2)

"\nThe Y distance between the two points is "(rtos YDIST 2 2)))

 

)

Link to comment
Share on other sites

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