我的自动打印命令换了打印机后就不能用了!先谢谢大家帮助我解决问题!我是新手!直接弄好后我学习就可以了!以前命令行输入,XXX 或者00和33都可以自动打印同个绘图区内的多份图纸的,我的图框是块的,只是最近换了台打印机!是否还有写相关文件要改呀! (defun c:xxx( / str)
(setq colorall 105) (N002 colorall) (if (not str) (exit)) (setvar "cmdecho" 0) (setq n 0) (princ "\n请选择为要列印的图框:") (setq ss (ssget)) (setq i (sslength ss)) (setq j 0) (repeat i (setq n(+ 1 n)) (setq en (ssname ss j)) (setq j (+ j 1)) (setq form (entget en)) (if(and (= (cdr(assoc 0 form)) "INSERT") (= (strcase(cdr(assoc 2 form))) "A3")) (progn (command "ucs" "") (setq pick_point(trans(cdr(assoc 10 form)) 0 1)) (setq form_scale(cdr(assoc 41 form))) (setq p1(list (- (car pick_point) (* 205 form_scale)) (- (cadr pick_point) (* 144.5 form_scale)))) (setq p2(list (+ (car pick_point) (* 205 form_scale)) (+ (cadr pick_point) (* 144.5 form_scale)))) (setq p3(list (- (car pick_point) (* 191 form_scale)) (+ (cadr pick_point) (* 138.5 form_scale)))) (setq p1 (trans p1 2 0)) (setq p2 (trans p2 2 0)) (setq p3 (trans p3 2 0)) (setq nfeosmode (getvar "osmode")) (setvar "osmode" 0) (command "layer" "t" "MARK" "") (setq dwgprefix-name (strcat "图档路径>>> " (getvar "dwgprefix"))) (setq p30 (polar p3 (* 1.75 pi) (* 6 form_scale))) (command "text" "s" "chinese" p30 (* 2.5 form_scale) 0.0 dwgprefix-name) (command "layer" "t" "0" "") (setq lastobject (entlast)) (setq acadver (getvar"acadver")) (if(= acadver "15.0") (progn (if(= str "5004") (command "-plot" "Y" "" "HP_5004.pc3" "A3" "M" "L" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "y" "Y")) (if(= str "XDC5") (command "-plot" "Y" "" "X-DC5.pc3" "A3 (297x420mm)" "M" "L" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "Y" "Y")) ) ) (if(= acadver "14.0") (progn (if(= str "5004") (progn (setvar "plotid" "HP_5004") (command "plot" "w" p1 p2 "5" "" "" "" "M" "0,0" "408,282" "0" "" "F" "0") ) ) (if(= str "XDC5") (progn (setvar "plotid" "X-DC5") (command "plot" "w" p1 p2 "5" "" "" "" "M" "0,0" "408,282" "0" "" "F" "0") ) ) ) ) (command "erase" lastobject "") (setvar "osmode" nfeosmode) (princ) ) ) (if(and (= (cdr(assoc 0 form)) "INSERT") (= (strcase(cdr(assoc 2 form))) "A4")) (progn (command "ucs" "") (setq pick_point(trans (cdr(assoc 10 form)) 0 1)) (setq form_scale(cdr(assoc 41 form))) (setq p1(list (- (car pick_point) (* 99.0 form_scale)) (- (cadr pick_point) (* 144.5 form_scale)))) (setq p2(list (+ (car pick_point) (* 101.0 form_scale)) (+ (cadr pick_point) (* 144.5 form_scale)))) (setq p3(list (- (car pick_point) (* 85.0 form_scale)) (+ (cadr pick_point) (* 138.5 form_scale)))) (setq p1 (trans p1 2 0)) (setq p2 (trans p2 2 0)) (setq p3 (trans p3 2 0)) (setq nfeosmode (getvar "osmode")) (setvar "osmode" 0) (command "layer" "t" "MARK" "") (setq dwgprefix-name (strcat "图档路径>>> " (getvar "dwgprefix"))) (setq p30 (polar p3 (* 1.75 pi) (* 6 form_scale))) (command "text" "s" "chinese" p30 (* 3.0 form_scale) 0.0 dwgprefix-name) (command "layer" "t" "0" "") (setq lastobject (entlast)) (setq acadver (getvar"acadver")) (if(= acadver "15.0") (progn (if(= str "5004") (command "-plot" "Y" "" "HP_5004.pc3" "A4" "M" "P" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "y" "Y")) (if(= str "XDC5") (command "-plot" "Y" "" "X-DC5.pc3" "A4 (210x297mm)" "M" "P" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "Y" "Y")) ) ) (if(= acadver "14.0") (progn (if(= str "5004") (progn (setvar "plotid" "HP_5004") (command "plot" "w" p1 p2 "5" "" "" "" "M" "" "A4" "90" "" "F" "0") ) ) (if(= str "XDC5") (progn (setvar "plotid" "X-DC5") (command "plot" "w" p1 p2 "5" "" "" "" "M" "" "A4" "90" "" "F" "0") ) ) ) ) (command "erase" lastobject "") (setvar "osmode" nfeosmode) (princ) ) ) ) (princ(strcat "******* 列印完毕,共" (rtos n 2 0) ".*******")) (princ) ) (princ "\nn002.lsp <快速列印> loaded!") (princ) (defun N002( color / dcl_id x y dx dy) (setq dcl_id (load_dialog "N002")) (if(> dcl_id 0)(new_dialog "N002" dcl_id)(prompt "Unable to open the dialog box!")) (start_image "a1") (setq x (dimx_tile "a1")) (setq y (dimy_tile "a1")) (setq dx (/ x 2) dy (/ y 1)) (dlg_recf 1 1 dx (- dy 2) color) (slide_image 0 -1 (- x 1) (- y 1) "N002.sld") (end_image) (action_tile "a1" "(setq fname (N002A $key colorall 1))") (action_tile "accept" "(if(= str nil)(progn(done_dialog dcl_id)(setq str \"5004\"))(done_dialog dcl_id))") (action_tile "cancel" "(setq str nil)") (if(/= str nil)(done_dialog dcl_id)) (start_dialog) )
(defun dlg_recf(x0 y0 w0 h0 colorf) (fill_image x0 y0 w0 h0 colorf) ) (defun N002A(key color color1 / w h dx dy) (setq w (dimx_tile key)) (setq h (dimy_tile key)) (setq dx (/ w 2) dy (/ h 1)) (start_image key) (dlg_recf 1 1 dx (- dy 2) -2) (dlg_recf dx 1 (- dx 2) (- dy 2) -2) (if(and (> $x 0)(< $x dx)) (if(< $y dy)(progn (setq str "5004") (dlg_recf 1 1 dx (- dy 2) color))) ) (if(and (> $x dx)(< $x (* dx 2))) (if(< $y dy)(progn (setq str "XDC5") (dlg_recf dx 1 (- dx 2) (- dy 2) color))) ) (slide_image 0 -1 (- x 1) (- y 1) "N002.sld") (end_image) )
以上第一个命令 (defun c:00 (/ s a n m lname li p0 p1 p2 x y xx yy) (setq a (getvar "cmdecho")) (setvar "cmdecho" 0) (setq kk (getvar "osmode")) (setvar "osmode" 0) (prompt "\n此程序用来打印图面上所有a3和a4图框里的图形!") (prompt "\n请在命令行里输入00即可!") (setq s (ssget "x" )) (setq n (sslength s)) (setq m 0) (setq l 0) (setq j 0) (while (< m n) (setq lname (ssname s m)) (setq li (entget lname)) (if (=(cdr (assoc '2 li)) "a3") (progn (setq pa (assoc '10 li)) (setq p0 ( list (nth 1 pa) (nth 2 pa))) (setq xx (cdr (assoc '41 li))) (setq yy (cdr (assoc '42 li))) (setq x (* xx 410)) (setq y (* yy 289)) (setq pp (polar p0 0 (/ x 2))) (setq p1 (polar pp (/ pi 2) (/ y 2))) (setq ppp (polar p0 pi (/ x 2))) (setq p2 (polar ppp (* pi 1.5) (/ y 2) )) (command "-plot" "yes" "" "EPSON EPL-1220 Advanced.pc3" "a3 297 x 420 mm" "m" "l" "yes" "w" p2 p1 "" "" "yes" "acad.ctb" "yes" "no" "no" "yes" "yes" ) (setq l (+ l 1)) ) ) (if (=(cdr (assoc '2 li)) "a4") (progn (setq pa (assoc '10 li)) (setq p0 ( list (nth 1 pa) (nth 2 pa))) (setq xx (cdr (assoc '41 li))) (setq yy (cdr (assoc '42 li))) (setq x (* xx 200)) (setq y (* yy 289)) (setq pp (polar p0 0 (/ x 2))) (setq p1 (polar pp (/ pi 2) (/ y 2))) (setq ppp (polar p0 pi (/ x 2))) (setq p2 (polar ppp (* pi 1.5) (/ y 2) )) (command "-plot" "yes" "" "EPSON EPL-1220 Advanced.pc3" "a4 210 x 297 mm" "m" "p" "yes" "w" p2 p1 "" "" "yes" "acad.ctb" "yes" "no" "no" "yes" "yes" ) (setq j (+ j 1)) ) ) (setq m (+ m 1 )) ) (setvar "osmode" kk) (setvar "cmdecho" a) (prompt "\注意只能在ap100-01上打印啊!!!") (princ) ) 以上第2个命令 N002:dialog { label="请选择印表机类型:"; alignment=centered; spacer_1; :image_button{ key="a1"; allow_accept=true; width=60; aspect_ratio=0.5; color=-2; } spacer_1; ok_cancel; } 以上第3个命令
(DEFUN C:33 (/ p1 p2 a b) (setq old (getvar "osmode")) (setvar "osmode" 37) (SETQ P1 (GETPOINT "\n选择打印框选第一点:")) (setq p2 (getcorner p1 "\n选择打印框选第二点:")) (setq p11 (car p2)) (setq p22 (cadr p1)) (setq p3 (list p11 p22)) (setq p111 (car p1)) (setq p222 (cadr p2)) (setq p4 (list p111 p222)) (setq a (distance p1 p3)) (setq b (distance p1 p4)) (if (> a b) (command "-plot" "yes" "" "EPSON EPL-1220 Advanced.pc3" "a3 297 x 420 mm" "m" "l" "yes" "w" p1 p2 "" "" "yes" "acad.ctb" "yes" "no" "no" "yes" "yes" ) (command "-plot" "yes" "" "EPSON EPL-1220 Advanced.pc3" "a4 210 x 297 mm" "m" "p" "yes" "w" p1 p2 "" "" "yes" "acad.ctb" "yes" "no" "no" "yes" "yes" ) ) (setvar "osmode" old) (prompt "\n打印在AP100-01彭泽胜电脑上请取图") (princ) ) 以上第4个命令 |