AutoCAD LISP绘制标准图框,if选择语句,绘制A1,A2,A3,A4图框,代码如下。
(defun c:test()
(setq size (getstring "请输入图纸大小AO,A1,A2,A3,A4<A3>:"))
(if (= size "")
(setq size "A3")
)
(setq size (strcase size))
(if (= size "A0") (setq p2 '(1189 841)))
(if (= size "A1") (setq p2 '(841 594)))
(if (= size "A2") (setq p2 '(594 420)))
(if (= size "A3") (setq p2 '(420 297)))
(if (= size "A4") (setq p2 '(297 210)))
(setq p1 '(0 0))
(command "rectang" p1 p2)
(command "zoom" "A")
(prin1)
)
(prompt "<<test>>自动绘制图框")
(prin1)
代码完。