@Kent1Cooper wrote:
....
(setq B (getreal "\n Input the length {X direction}: "))
....
(setq C (getreal "\n Input the width {Y direction}: "))
(setq A2 (mapcar '+ A (list B C)))
(command "_.rectang" "none" A "none" A2)
....
I would also suggest using (getdist) instead of (getreal) for the length and width. That way, you can specify the distance by either typing in or picking points on-screen, even just one additional point for each with rubber-banding from your 'A' location. And if you use Architectural or Fractional Imperial units, you can type it in feet-inches-fractions format if you want.
Also, the A2 variable isn't really needed, since it's used only once -- may as well just put the calculation right in there.
(defun C:Test (/ A B C)
(setq A (getpoint "\n Basic point: "))
(initget (+ 1 2 4))
(setq B (getdist A "\n Input the length {X direction}: "))
(initget (+ 1 2 4))
(setq C (getdist A "\n Input the width {Y direction}: "))
(command "_.rectang" "none" A "none" (mapcar '+ A (list B C)))
(princ)
)
BUT FURTHERMORE, try the RECTANG command and its Dimensions option, which gives you the same result [without rubber-banding] except for in addition allowing you to pick which quadrant the result falls in relative to the first corner. No code required. Even in your code, you could get other quadrants than only the upper-right one, by removing the 4's from the (initget) argument, to allow negative values.
Kent Cooper, AIA