TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Biscuits on February 14, 2020, 10:00:11 AM

Title: UCS Error Handler
Post by: Biscuits on February 14, 2020, 10:00:11 AM
I'm at a loss on how to include an error handler that would make sure "UCS world" get restored if this routine is canceled.
Would appreciate any help. Thanks

Code: [Select]
;MyRect
(defun c:MR ()

(setvar "autosnap" 47)
(setvar "autosnap" (boole 6 (getvar "autosnap") 8))

(setq p1(trans(getpoint"\nCorner of rectangle: ")1
0)p2(trans(getpoint"\npoint on X axis: "(trans p1 0 1))1 0))

(command"._UCS""_Z"(trans p1 0 1)(trans p2 0 1))
(command"._RECTANGLE"(trans p1 0 1))

(while(wcmatch(getvar"CMDNAMES")"*RECTANGLE*")(command pause))
  (command"._UCS""w")
  (Command "change" "last" "" "p" "LA" "CUSTOMER_HOUSE" "")
  (setvar "autosnap" 47)
(princ)
)