明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2483|回复: 8

这个批量打印的lisp为何不能运行?

[复制链接]
发表于 2004-11-11 23:11 | 显示全部楼层 |阅读模式
AutoCAD中用PLOT命令每次只能打印一张图纸,如果在一个图形文件内有多张大小一样的图纸成纵向排列,间距M_d=500mm。通过Mplot只需调试一张,便可打印所有图纸。程序如下:


  (defun c:Mplot()



                         (setq p_1 (getpoint"\n\tFirst CORNER:")



                                                 P_2 (getPOINT"\n\tOther CORNER:")



                                                 n (getint"\n\t???:<1>"))



                         (if (= n nil) (setq n 1))



                         (setq m_d 500)



                 (REPEAT n



                                                 (command"plot" "w" P_1 P_2 "n" COMMAND) </P< p>



        (setq p_1 (polar p_1 (/ pi 2) m_d) p_2 (polar p_2 (/ pi 2) m_d))



         )



                 ) ;enddef



我加载后键入mplot,cad命令行提示参数值错误,怎么回事?这个程序是针对图纸纵向排列的,如果图纸横向排列,应该怎样修改?请高手指点,感激不尽.
 楼主| 发表于 2004-11-14 15:15 | 显示全部楼层
没人帮我吗
发表于 2004-11-15 20:09 | 显示全部楼层
(command"plot" "w" P_1 P_2 "n" COMMAND) </P< p>?


在CAD命令行运行: (command "plot")试试会产生那些提问,再修改上面这句的参数


如果是横向排列,把(setq p_1 (polar p_1 (/ pi 2) m_d) p_2 (polar p_2 (/ pi 2) m_d))这句中的两个 (/ pi 2) 换成0就可以了!
 楼主| 发表于 2004-11-18 11:37 | 显示全部楼层
谢谢mkhsj928,输入mplot后可以选打印范围,但输入图纸数量后提示出错,不知何故.命令行提示如下:
命令: _appload 已成功加载 print.lsp.
命令:
命令:
命令: mplot
First CORNER:
Other CORNER:
???:<1>4 未知命令┃N┃.按F1查看帮助.
; 错误:参数值错误: AutoCAD 命令: #<SUBR @030a2ac8 COMMAND>
 楼主| 发表于 2004-11-27 10:24 | 显示全部楼层
发表于 2004-12-2 10:23 | 显示全部楼层
你找的程序太老了,好像还是在R14上用的。
发表于 2005-3-16 21:36 | 显示全部楼层
啊哈,我找到这个了。我也和楼主一样用了这个r14的批量打印的程序,但只能打印纵向排列的图纸。能不能像阵列命令一样输入范围、行数和列数就自动按顺序打印同样大小的图纸。原理大概是这样:首先选取最左上角一张图纸的两个对角点,输入行数,输入列数,就会自动从左到右,从上到下打印。(行距和列距定义好)
发表于 2005-3-17 12:30 | 显示全部楼层
这个是我的打印程序,适合于2002,2005,可以在 模型,布局中打,自己改一下很容易实现你的功能
  1. _____________________________________8.打印_________________________________________________________________________________
  2. ;;;2005-3-8最后修改,加上布局打印的功能,袁轶琳提,BY SWAYWOOD
  3. (defun c:prt (/ absx absy dir b equip)
  4.    (setvar "cmdecho" 0)
  5.    (if (not prtax)
  6.        (setq prtax "A3")
  7.    )
  8.    (if (= prtax "")
  9.        (setq prtax "A3")
  10.    )
  11.    (while (and (/= b "A1")
  12.              (/= b "A2")
  13.              (/= b "A3")
  14.              (/= b "A4")
  15.              (/= b "")
  16.    )
  17.        (setq b (strcase (getstring (strcat "\n请输入图幅<" prtax ">:"))))
  18.    )
  19.    (setq  prtax (if (= b "")
  20.     prtax
  21.     b
  22.              )
  23.   prtp1 (getpoint "\n请选择第一点:")
  24.   prtp2 (getcorner prtp1 "\n请选择第二点:")
  25.   absx   (abs (- (car prtp1) (car prtp2)))
  26.   absy   (abs (- (cadr prtp1) (cadr prtp2)))
  27.   dir     (if (> absx absy)
  28.     "l"
  29.     "p"
  30.              )
  31.    )
  32.    (cond
  33.        ((= prtax "A3")
  34.          (progn
  35.              (setq equip "\\\\morimatsu\\Kyocera Mita KM-4035 KX(design1)")
  36.              (setq axx prtax)
  37.          )
  38.        )
  39.        ((= prtax "A4")
  40.          (progn
  41.              (setq equip "\\\\morimatsu\\Kyocera Mita KM-4035 KX(design1)")
  42.              (setq axx prtax)
  43.          )
  44.        )
  45.        ((= prtax "A1")
  46.          (progn
  47.              (setq equip "\\\\MORIMATSU\\HP DesignJet 430 (D/A1) by HP")
  48.              (setq axx "过大尺寸:ISO A1 ")
  49.          )
  50.        )
  51.        ((= prtax "A2")
  52.          (progn
  53.              (setq equip "\\\\MORIMATSU\\HP DesignJet 430 (D/A1) by HP")
  54.              (setq axx "过大尺寸:ISO A2   (横向)")
  55.          )
  56.        )
  57.    )
  58.    (command "_.zoom" "w" prtp1 prtp2)
  59.    (setq pwhere (getvar "CTAB"))
  60.    (if (and axx equip dir prtp1 prtp2 (plotstyle))
  61.        (if  (= pwhere "Model")
  62.            (command "plot"   "y"         pwhere   equip     axx         "m"         dir
  63.                "n"         "w"         prtp1     prtp2     "f"         "c"         "y"
  64.                "acad(cyan).ctb"               "y"         "n"         "n"         "n"
  65.                "y"
  66.              )
  67.            (command "plot"   "y"         pwhere   equip     axx         "m"         dir
  68.                "n"         "w"         prtp1     prtp2     "f"         "c"         "y"
  69.                "acad(cyan).ctb"               "y"         "n"         "n"         "n"
  70.                "n"         "n"         "y"
  71.              )
  72.        )
  73.    )
  74. )
  75. (defun plotstyle (/ DIR DIRA DIRB DIRC)
  76.    (if (findfile "c:\\Program Files\\Acadm 6\\acad.exe")
  77.        (setq dir "c:\\Program Files\\Acadm 6\\Plot Styles\")
  78.    )
  79.    (if (findfile "d:\\Program Files\\Acadm 6\\acad.exe")
  80.        (setq dir "d:\\Program Files\\Acadm 6\\Plot Styles\")
  81.    )
  82.    (if (findfile "c:\\Program Files\\autocad 2005\\acad.exe")
  83.        (progn
  84.            (setq dira "C:\\Documents and Settings\"
  85.          dirb (getenv "username")
  86.          dirc "\\Application Data\\Autodesk\\AutoCAD 2005\\R16.1\\chs\\Plot Styles\"
  87.            )
  88.            (setq dir (strcat dira dirb dirc))
  89.        )
  90.    )
  91.    (if (findfile "d:\\Program Files\\autocad 2005\\acad.exe")
  92.        (progn
  93.            (setq dira "d:\\Documents and Settings\"
  94.          dirb (getenv "username")
  95.          dirc "\\Application Data\\Autodesk\\AutoCAD 2005\\R16.1\\chs\\Plot Styles\"
  96.            )
  97.            (setq dir (strcat dira dirb dirc))
  98.        )
  99.    )
  100.    (if (findfile (strcat dir "acad(cyan).ctb"))
  101.        t
  102.        (vl-file-copy
  103.            "\\\\morimatsu\\design-soft\\swcad\\support\\acad(cyan).ctb"
  104.            (strcat dir "acad(cyan).ctb")
  105.        )
  106.    )
  107. )
发表于 2006-1-19 23:14 | 显示全部楼层
glow=255,red,2]路过的 看一下 打印问题的确很凡人的 如果图形在不同的CAD图挡能不能批次打印 好象实现不了啊[[/glow]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 07:02 , Processed in 0.168816 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表