發佈日期:
分類:
如何在AutoCAD R14版本中‧使用AutoLISP作快速列印
列印很多時,列印也是一項麻煩的工作,特別是幾十張的圖紙,明明就是相同的尺寸、邊界、畫筆的顏色,在AutoCAD內也要打開列印版面設置一輪,才可開始列印。
今次設計目的,只需使用者選擇印表機及輸入圖紙的對角位置,其他的全部使用預設設定。
註:以下程式經由AutoCAD R14測試。
;Sub-program of C:P14. (DEFUN PS14(T1 / A B A1 A2 A3 A4 B1 B2 B3 B4 X Y) (GRAPHSCR) (SETVAR "CMDECHO" 0) (SETVAR "OSMODE" 59) ;Set drawing margin is 5mm. (SETQ MARGIN 5) (SETQ A (GETPOINT "\\nEnter upper leftmost point: ")) (SETQ B (GETCORNER A "\\nEnter lower rightmost point: ")) (SETQ A1 (CAR A)) (SETQ A2 (CADR A)) (SETQ B1 (CAR B)) (SETQ B2 (CADR B)) (SETQ A3 (- A1 MARGIN)) (SETQ A4 (+ A2 MARGIN)) (SETQ B3 (+ B1 MARGIN)) (SETQ B4 (- B2 MARGIN)) (SETQ X (LIST A3 A4)) (SETQ Y (LIST B3 B4)) (SETVAR "CMDDIA" 0) (SETVAR "OSMODE" 0) (COMMAND "PLOT" "W" X Y "5" "N" "N" "M" "" T1 "N" "N" "F" "0") (SETVAR "CMDDIA" 1) (SETVAR "CMDECHO" 1) (SETVAR "OSMODE" 59) (GRAPHSCR) ) ;Main program. (DEFUN C:P14(/ A B) (PROMPT "\\nPrint drawing for AutoCAD R14.") (INITIAL) (SETQ A (ATOF (GETVAR "ACADVER"))) (IF (AND (>= A 14) (< A 15)) (PROGN (SETQ B (GETSTRING "\\nPortscape(1)/Landscape(2): ")) (IF (= B "1") (PS14 "0") ) (IF (= B "2") (PS14 "90") ) ) (PROGN (ALERT "AutoCAD version is not R14.") ) ) (PRINC) )
發佈留言