; Draw an ISO Format (08-VII-2012)
(defun c:IPF( / listSize size poz border )
(if (and (not (initget "A4 A3 A2 A1 A0"))
(setq size (getkword "\nFormat [A4/A3/A2/A1/A0]: "))
(not (initget "Portrait Landscape"))
(setq poz (getkword "\nPozition [Portrait/Landscape]: ")))
(progn
(setq listSize (nth (abs (- 4 (atoi (substr size 2))))
'((297.0 210.0) (420.0 297.0) (594.0 420.0) (841.0 594.0) (1189.0 841.0)))
border 20.0)
(if (= poz "Portrait") (setq listSize (reverse listSize)))
;;; outer rectangle
(command "_RECTANGLE" "_non" '(0.0 0.0)
"_non" listSize)
;;; inner rectangle
(command "_RECTANGLE" "_non" (list border border)
"_non" (list (- (car listSize) border)
(- (cadr listSize) border)))

(command "_ZOOM" "_E")
)
)
(princ)
)
(c:ipf)

Advertisements