[求助]如何实现快速打印一个窗口内的多份图纸!-有LSP
<p><font color="#2b4dd5" size="3">我的自动打印命令换了打印机后就不能用了!先谢谢大家帮助我解决问题!我是新手!直接弄好后我学习就可以了!以前命令行输入,XXX 或者00和33都可以自动打印同个绘图区内的多份图纸的,我的图框是块的,只是最近换了台打印机!是否还有写相关文件要改呀!</font></p><p><br/><font color="#dd22b8" size="4">(defun c:xxx( / str)</font></p><p><font color="#dd22b8" size="4"> (setq colorall 105)<br/> (N002 colorall)<br/> (if (not str) (exit))</font></p><p><font color="#dd22b8" size="4"> (setvar "cmdecho" 0)<br/> (setq n 0)<br/> (princ "\n请选择为要列印的图框:") <br/> (setq ss (ssget))<br/> (setq i (sslength ss))<br/> (setq j 0)<br/> (repeat i<br/> (setq n(+ 1 n))<br/> (setq en (ssname ss j))<br/> (setq j (+ j 1))<br/> (setq form (entget en))<br/> (if(and (= (cdr(assoc 0 form)) "INSERT") (= (strcase(cdr(assoc 2 form))) "A3"))<br/> (progn<br/> (command "ucs" "")<br/> (setq pick_point(trans(cdr(assoc 10 form)) 0 1))<br/> (setq form_scale(cdr(assoc 41 form)))<br/> (setq p1(list (- (car pick_point) (* 205 form_scale)) (- (cadr pick_point) (* 144.5 form_scale))))<br/> (setq p2(list (+ (car pick_point) (* 205 form_scale)) (+ (cadr pick_point) (* 144.5 form_scale))))<br/> (setq p3(list (- (car pick_point) (* 191 form_scale)) (+ (cadr pick_point) (* 138.5 form_scale))))<br/> (setq p1 (trans p1 2 0))<br/> (setq p2 (trans p2 2 0))<br/> (setq p3 (trans p3 2 0))<br/> (setq nfeosmode (getvar "osmode"))<br/> (setvar "osmode" 0)<br/> (command "layer" "t" "MARK" "")<br/> (setq dwgprefix-name (strcat "图档路径>>> " (getvar "dwgprefix")))<br/> (setq p30 (polar p3 (* 1.75 pi) (* 6 form_scale)))<br/> (command "text" "s" "chinese" p30 (* 2.5 form_scale) 0.0 dwgprefix-name)<br/> (command "layer" "t" "0" "")<br/> (setq lastobject (entlast))<br/> (setq acadver (getvar"acadver"))<br/> (if(= acadver "15.0")<br/> (progn<br/> (if(= str "5004")<br/> (command "-plot" "Y" "" "HP_5004.pc3" "A3" "M" "L" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "y" "Y"))<br/> (if(= str "XDC5")<br/> (command "-plot" "Y" "" "X-DC5.pc3" "A3 (297x420mm)" "M" "L" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "Y" "Y"))<br/> )<br/> )<br/> (if(= acadver "14.0")<br/> (progn<br/> (if(= str "5004")<br/> (progn<br/> (setvar "plotid" "HP_5004")<br/> (command "plot" "w" p1 p2 "5" "" "" "" "M" "0,0" "408,282" "0" "" "F" "0")<br/> )<br/> )<br/> (if(= str "XDC5")<br/> (progn<br/> (setvar "plotid" "X-DC5")<br/> (command "plot" "w" p1 p2 "5" "" "" "" "M" "0,0" "408,282" "0" "" "F" "0")<br/> )<br/> )<br/> )<br/> )<br/> (command "erase" lastobject "")<br/> (setvar "osmode" nfeosmode) <br/> (princ)<br/> )<br/> )<br/> (if(and (= (cdr(assoc 0 form)) "INSERT") (= (strcase(cdr(assoc 2 form))) "A4"))<br/> (progn<br/> (command "ucs" "")<br/> (setq pick_point(trans (cdr(assoc 10 form)) 0 1))<br/> (setq form_scale(cdr(assoc 41 form)))<br/> (setq p1(list (- (car pick_point) (* 99.0 form_scale)) (- (cadr pick_point) (* 144.5 form_scale))))<br/> (setq p2(list (+ (car pick_point) (* 101.0 form_scale)) (+ (cadr pick_point) (* 144.5 form_scale))))<br/> (setq p3(list (- (car pick_point) (* 85.0 form_scale)) (+ (cadr pick_point) (* 138.5 form_scale))))<br/> (setq p1 (trans p1 2 0))<br/> (setq p2 (trans p2 2 0))<br/> (setq p3 (trans p3 2 0))<br/> (setq nfeosmode (getvar "osmode"))<br/> (setvar "osmode" 0)<br/> (command "layer" "t" "MARK" "")<br/> (setq dwgprefix-name (strcat "图档路径>>> " (getvar "dwgprefix")))<br/> (setq p30 (polar p3 (* 1.75 pi) (* 6 form_scale)))<br/> (command "text" "s" "chinese" p30 (* 3.0 form_scale) 0.0 dwgprefix-name)<br/> (command "layer" "t" "0" "")<br/> (setq lastobject (entlast))<br/> (setq acadver (getvar"acadver"))<br/> (if(= acadver "15.0")<br/> (progn<br/> (if(= str "5004")<br/> (command "-plot" "Y" "" "HP_5004.pc3" "A4" "M" "P" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "y" "Y"))<br/> (if(= str "XDC5")<br/> (command "-plot" "Y" "" "X-DC5.pc3" "A4 (210x297mm)" "M" "P" "n" "W" p1 p2 "F" "C" "Y" "acad.ctb" "Y" "N" "N" "Y" "Y"))<br/> )<br/> )<br/> (if(= acadver "14.0")<br/> (progn<br/> (if(= str "5004")<br/> (progn<br/> (setvar "plotid" "HP_5004")<br/> (command "plot" "w" p1 p2 "5" "" "" "" "M" "" "A4" "90" "" "F" "0")<br/> )<br/> )<br/> (if(= str "XDC5")<br/> (progn<br/> (setvar "plotid" "X-DC5")<br/> (command "plot" "w" p1 p2 "5" "" "" "" "M" "" "A4" "90" "" "F" "0")<br/> )<br/> )<br/> )<br/> )<br/> <br/> (command "erase" lastobject "")<br/> (setvar "osmode" nfeosmode) <br/> (princ)<br/> )<br/> )<br/> )<br/> (princ(strcat "******* 列印完毕,共" (rtos n 2 0) ".*******"))<br/> (princ)<br/>)<br/> (princ "\nn002.lsp <快速列印> loaded!")<br/> (princ)</font></p><p><font color="#dd22b8" size="4"></font></p><p><br/><font color="#dd22b8" size="4">(defun N002( color / dcl_id x y dx dy)<br/> (setq dcl_id (load_dialog "N002"))<br/> (if(> dcl_id 0)(new_dialog "N002" dcl_id)(prompt "Unable to open the dialog box!"))<br/> (start_image "a1")<br/> (setq x (dimx_tile "a1"))<br/> (setq y (dimy_tile "a1"))<br/> (setq dx (/ x 2) dy (/ y 1))<br/> (dlg_recf 1 1 dx (- dy 2) color)<br/> (slide_image 0 -1 (- x 1) (- y 1) "N002.sld")<br/> (end_image)<br/> (action_tile "a1" "(setq fname (N002A $key colorall 1))")<br/> (action_tile "accept" "(if(= str nil)(progn(done_dialog dcl_id)(setq str \"5004\"))(done_dialog dcl_id))")<br/> (action_tile "cancel" "(setq str nil)")<br/> (if(/= str nil)(done_dialog dcl_id))<br/> (start_dialog)<br/>)</font></p><p><br/><font color="#dd22b8" size="4">(defun dlg_recf(x0 y0 w0 h0 colorf)<br/> (fill_image x0 y0 w0 h0 colorf)<br/>)<br/> <br/>(defun N002A(key color color1 / w h dx dy)<br/> (setq w (dimx_tile key))<br/> (setq h (dimy_tile key))<br/> (setq dx (/ w 2) dy (/ h 1))<br/> (start_image key)<br/> (dlg_recf 1 1 dx (- dy 2) -2)<br/> (dlg_recf dx 1 (- dx 2) (- dy 2) -2)<br/> (if(and (> $x 0)(< $x dx))<br/> (if(< $y dy)(progn<br/> (setq str "5004")<br/> (dlg_recf 1 1 dx (- dy 2) color)))<br/> )<br/> (if(and (> $x dx)(< $x (* dx 2)))<br/> (if(< $y dy)(progn<br/> (setq str "XDC5")<br/> (dlg_recf dx 1 (- dx 2) (- dy 2) color)))<br/> )<br/> (slide_image 0 -1 (- x 1) (- y 1) "N002.sld")<br/> (end_image)<br/> )</font></p><p><font size="5">以上第一个命令</font></p><p><font color="#bd1ae6" size="5">(defun c:00 (/ s a n m lname li p0 p1 p2 x y xx yy)<br/>(setq a (getvar "cmdecho"))<br/>(setvar "cmdecho" 0)<br/>(setq kk (getvar "osmode"))<br/>(setvar "osmode" 0)<br/>(prompt "\n此程序用来打印图面上所有a3和a4图框里的图形!")<br/>(prompt "\n请在命令行里输入00即可!")</font></p><p><font color="#bd1ae6" size="5">(setq s (ssget "x" )) <br/>(setq n (sslength s)) <br/>(setq m 0) <br/>(setq l 0)<br/>(setq j 0)<br/>(while (< m n) <br/> (setq lname (ssname s m))<br/> (setq li (entget lname))<br/> (if (=(cdr (assoc '2 li)) "a3")<br/> (progn <br/> (setq pa (assoc '10 li)) <br/> (setq p0 ( list (nth 1 pa) (nth 2 pa))) <br/> (setq xx (cdr (assoc '41 li))) <br/> (setq yy (cdr (assoc '42 li)))<br/> (setq x (* xx 410)) <br/> (setq y (* yy 289))<br/> (setq pp (polar p0 0 (/ x 2)))<br/> (setq p1 (polar pp (/ pi 2) (/ y 2))) <br/> (setq ppp (polar p0 pi (/ x 2)))<br/> (setq p2 (polar ppp (* pi 1.5) (/ y 2) )) <br/> (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" )<br/> (setq l (+ l 1))<br/> <br/> )<br/> )<br/> <br/> (if (=(cdr (assoc '2 li)) "a4")<br/> (progn <br/> (setq pa (assoc '10 li)) <br/> (setq p0 ( list (nth 1 pa) (nth 2 pa))) <br/> (setq xx (cdr (assoc '41 li))) <br/> (setq yy (cdr (assoc '42 li)))<br/> (setq x (* xx 200)) <br/> (setq y (* yy 289)) <br/> (setq pp (polar p0 0 (/ x 2)))<br/> (setq p1 (polar pp (/ pi 2) (/ y 2))) <br/> (setq ppp (polar p0 pi (/ x 2)))<br/> (setq p2 (polar ppp (* pi 1.5) (/ y 2) )) <br/> (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" )<br/> (setq j (+ j 1))<br/> <br/> )<br/> )<br/> <br/> <br/> <br/> (setq m (+ m 1 ))<br/>)<br/>(setvar "osmode" kk)<br/>(setvar "cmdecho" a)<br/>(prompt "\注意只能在ap100-01上打印啊!!!")<br/>(princ)<br/>)</font></p><p><font size="5">以上第2个命令</font></p><p><font color="#e61ae6" size="5">N002:dialog {<br/> label="请选择印表机类型:";<br/> alignment=centered;<br/> spacer_1;</font></p><p><font size="5"><font color="#e61ae6"> :image_button{<br/> key="a1";<br/> allow_accept=true;<br/> width=60;<br/> aspect_ratio=0.5;<br/> color=-2;<br/> }<br/> spacer_1;<br/> ok_cancel;<br/> }<br/></font> 以上第3个命令<br/></font></p><p>(<font size="4">DEFUN C:33 (/ p1 p2 a b)<br/> (setq old (getvar "osmode"))<br/> (setvar "osmode" 37)<br/> <br/> (SETQ P1 (GETPOINT "\n选择打印框选第一点:"))<br/> (setq p2 (getcorner p1 "\n选择打印框选第二点:"))<br/> (setq p11 (car p2))<br/> (setq p22 (cadr p1))<br/> (setq p3 (list p11 p22))<br/> (setq p111 (car p1))<br/> (setq p222 (cadr p2))<br/> (setq p4 (list p111 p222))<br/> (setq a (distance p1 p3))<br/> (setq b (distance p1 p4))<br/> (if (> a b)<br/> (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" )<br/> (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" )<br/> )<br/> (setvar "osmode" old)<br/> (prompt "\n打印在AP100-01彭泽胜电脑上请取图")<br/> (princ)<br/> )</font></p><p><font size="5">以上第4个命令</font></p><p></p><p></p><p></p> 一共6个附件,明天继续上传! 后面怎么没有啊 !!! 这几个月都没有信了? 野狼谷/〈M〉 发表于 2013-1-21 21:22 static/image/common/back.gif这几个月都没有信了?
(DEFUN C:111 (/ 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" "" "\\\\192.168.1.48\\HP Universal Printing PCL 6" "a4" "m" "l" "yes" "w" p2 p1 "f" "c" "yes" "acad.ctb" "yes" "a" "no" "yes" "yes" )
(command "-plot" "yes" "" "\\\\192.168.1.48\\HP Universal Printing PCL 6" "a4" "m" "p" "yes" "w" p2 p1 "f" "c" "yes" "acad.ctb" "yes" "a" "no" "yes" "yes" )
)
(setvar "osmode" old)
(prompt "\n请在打印服务器上取图!!!")
(princ)
)
以上单独打印 (defun *error* (ERROR)
(princ "钣金开发事业群 群QQ 49400228:")
(setvar "osmode" 703)
)
(defun c:222 ( / a j k kk l li lname m n p0 p0x p0y p1 p1x p1y p2 p2x p2y pa pp ppp s x xx y yy)
(setq a (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq kk (getvar "osmode"))
(setvar "osmode" 0)
(command "ucs" "")
(prompt "\n此程序用来打印框选中所有a3和a4图框里的图形及工艺流程卡!")
(prompt "\nby:yutianweidi!")
(setq s (ssget))
(setq n (sslength s))
(setq m 0)
(setq l 0)
(setq j 0)
(setq k 0)
(while (< m n)
(setq lname (ssname s m))
(setq li (entget lname))
(if(=(cdr(assoc '2li)) "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" "" "\\\\192.168.1.48\\HP Universal Printing PCL 6" "a3" "m" "l" "yes" "w" p2 p1 "f" "c" "yes" "acad.ctb" "yes" "a" "no" "yes" "yes" )
(setq l (+ l 1))
)
)
(if(=(cdr(assoc '2li)) "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" "" "\\\\192.168.1.48\\HP Universal Printing PCL 6" "a4" "m" "p" "yes" "w" p2 p1 "f" "c" "yes" "acad.ctb" "yes" "a" "no" "yes" "yes" )
(setq j (+ j 1))
)
)
(if(=(cdr(assoc '2li)) "a5")
(progn
(setq pa(assoc '10 li))
(setq p0x (nth 1 pa))
(setq p0y (nth 2 pa))
(setq xx (cdr (assoc '41 li)))
(setq yy (cdr (assoc '42 li)))
(setq p1x(+ p0x (* xx 200)))
(setq p1y(- p0y (* yy 289)))
(setq p1 (list p1x p1y))
(setq p2x(+ p0x (* xx 2)))
(setq p2y(- p0y (* yy 2)))
(setq p2 (list p2x p2y))
(command "-plot" "yes" "" "\\\\192.168.1.48\\HP Universal Printing PCL 6" "a5" "m" "l" "yes" "w" p2 p1 "f" "c" "yes" "acad.ctb" "yes" "a" "no" "yes" "yes" )
(setq k (+ k 1))
)
)
(setq m (+ m 1 ))
)
(setvar "osmode" kk)
(setvar "cmdecho" a)
(prompt "\仅供彭氏工创使用!!!")
(princ)
) 以上批量打印,终于修复问题了! 楼主你的批量打印占线很长啊
非常感谢您的源代码
页:
[1]
2