AeJay Posted May 1, 2023 Posted May 1, 2023 (edited) (defun c:dr209 ( / pt1 pt2) (while (setq pt1 (getpoint "\nPick 1st point ")) (setq pt2 (getpoint "\nPick point 2 & Base Point ")) (command "dim" "ver" pt1 pt2 (mapcar '+ pt2 (list 200.0 0.0 0.0)) "" "exit") ) (princ) ) Got this code from Bigal, all working great but currently trying to configure it to have an IF statement to determine which of pt1 and pt2 is shorter, it will be using that pt for the variable "(command "dim" "ver" pt1 pt2 (mapcar '+ pt2 (list 200.0 0.0 0.0)) "" "exit")" which is set to pt2 at the moment. Tried this, but won't work: (defun c:dr1 ( / pt1 pt2 shorter-pt) (while (setq pt1 (getpoint "\nPick 1st point ")) (setq pt2 (getpoint "\nPick point 2 & Base Point ")) (setq shorter-pt (if (< (distance pt1 pt2) (distance pt2 (mapcar '+ pt2 (list 200.0 0.0 0.0))))) pt1 pt2) (command "dim" "ver" pt1 pt2 (mapcar '+ shorter-pt (list 200.0 0.0 0.0)) "" "exit") ) (princ) ) Edited May 1, 2023 by AeJay Quote
BIGAL Posted May 1, 2023 Posted May 1, 2023 Admin please join to other post re this task You should have asked me, this is to do with the bottom right dim in your sample dwg, the answer is yes work out which is shorter then swap pt1 and pt2. An example (setq d1 (distance p1 p3) d2 (distance p2 p3) ) (if (> d1 d2) (progn (setq temp p1) (setq p1 p2) (setq p2 temp) ) ) 1 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.