; ;+-------------------------------------------------------------------------+ ;| SETUP.LSP | ;| Ver. 1.0 Feb. 25, 1986 | ;| | ;| J.J.K. Feb. 25, 1986 | ;| | ;| C.L.H Nov. 29, 1987 Added error routine and input checking. | ;| | ;| This program will set the Units and Limits of a new drawing, and will | ;| draw a border line around the drawing. | ;+-------------------------------------------------------------------------+ ; ; (vmon) (defun seterr (s) ;define an error handler (if (/= s "Function cancelled") (princ (strcat "\nError: " s)) ) (menucmd "S=S") (setvar "cmdecho" oce) ;restore previous cmdecho value (setvar "lunits" olu) ;restore previous linear units value (setq *error* oer ;restore previous error handler seterr nil ) (princ) ) (apply '(lambda (/ a b d cx cy xl yl oer olu oce) (setq oce (getvar "cmdecho")) ;store current cmdecho value (setvar "cmdecho" 0) ;turn cmdecho off (menucmd "S=UNITS") (setq oer *error* ;store AutoLisp error routine *error* seterr) ;temporarily replace it (initget (+ 1 2 4)) ;no null input, negative or zero values (setq a (getint "\nSelect the Units from the screen menu: ")) (menucmd (strcat "S=U" (itoa a))) (cond ( (= a 5) (setq a 2 d 5) ) ) (setq olu (getvar "lunits")) ;store current linear units setting (command "setvar" "lunits" a) ;set linear units to new value (initget (+ 1 4)) ;0 ok, but no null or negative values (setq b (getreal "\nSelect the Scale from the screen menu: ")) (cond ( (= b 0) (progn (initget (+ 1 2 4)) (setq b (getreal "\nEnter the scale: ")) (setq b (float b)) ) ) ) (cond ( (= d 5) (menucmd "S=METRIC") ) (T (menucmd "S=ENGLISH") ) ) (initget (+ 1 4)) (setq cx (getdist "\nSelect the Paper size from the screen menu: ")) (initget (+ 1 4)) (setq cy (getdist)) (cond ( (= cx 0) (progn (initget (+ 1 2 4)) (setq cx (getdist "\nEnter the Horizontal Dimension of the paper: ")) (initget (+ 1 2 4)) (setq cy (getdist "\nEnter the Vertical Dimension of the paper: ")) ) ) ) (setq xl (* b cx) yl (* b cy)) (command "limits" "0,0" (list xl yl) "insert" "border" "0,0" xl yl "0" "zoom" "a" ) (menucmd "S=S") (setvar "cmdecho" oce) ;restore previous value for cmdecho (setq *error* oer ;restore previous error handler seterr nil ) (princ) ) '() )