aws 发表于 2024-9-6 15:11:32

关于设定打印机参数

(defun c:gg()
(setq obj(vlax-ename->vla-object(car(entsel "\n点击要打印的外框:"))))(or obj(quit))
(vla-getboundingbox obj 'minp 'maxp)
(setq p1(vlax-safearray->list minp))
(setq p9(vlax-safearray->list maxp))
(setq desktop(strcat(vla-item(vlax-get(vlax-create-object "WScript.Shell" )'SpecialFolders)"Desktop")"\\PDF图纸"));---获取桌面位置
(if(>(-(car p9)(car p1))(-(cadr p9)(cadr p1)));---如果宽度大于高度,横向打印,否则纵向打印
    (setq fx "l")
    (setq fx "p")
)
(setvar "CMDECHO" 0)
(command "-plot" "y" "模型" "DWG To PDF.pc3" "ISO full bleed 4A0 (1682.00 x 2378.00 毫米)" "m" fx "n" "w" "non" p1 "non" p9 "f" "c" "y" "" "y" "a" desktop "n" "y")
(setvar "CMDECHO" 1)
(princ)
)


请问这段里面的command命令,如何改成其他方式编写?比如vla函数。

sandyvs 发表于 2024-9-6 17:24:21

http://bbs.xdcad.net/forum.php?mod=viewthread&tid=727578&highlight=%E9%80%9A%E7%94%A8%2B%E6%89%93%E5%8D%B0
看看晓东的
(vl-load-com)
(defun PlotToFile (ConfigName         MediaName   Window
                   FileName         /               AcadObj
                   ActiveDocObj         ActiveLayoutObj
                   PlotObj
                  )
(setq      AcadObj                (vlax-get-acad-object)
      ActiveDocObj      (vla-get-ActiveDocument AcadObj)
      ActiveLayoutObj      (vla-get-ActiveLayout ActiveDocObj)
)
(vla-RefreshPlotDeviceInfo ActiveLayoutObj)
(vla-Put-ConfigName ActiveLayoutObj ConfigName)
(setq PlotObj (vla-get-Plot ActiveDocObj))
(vla-Put-CanonicalMediaName ActiveLayoutObj MediaName)
(vla-Put-StandardScale ActiveLayoutObj acScaleToFit)
(vla-Put-PlotRotation ActiveLayoutObj ac0degrees)
(vla-put-PlotOrigin
    ActiveLayoutObj
    (vlax-make-variant
      (vlax-make-safearray vlax-vbDouble '(0 . 1))
    )
)
(vla-Put-CenterPlot ActiveLayoutObj :vlax-false)
(vla-SetWindowToPlot
    ActiveLayoutObj
    (vlax-make-variant
      (vlax-safearray-fill
      (vlax-make-safearray vlax-vbDouble '(0 . 1))
      (car Window)
      )
    )
    (vlax-make-variant
      (vlax-safearray-fill
      (vlax-make-safearray vlax-vbDouble '(0 . 1))
      (cadr Window)
      )
    )
)
(vla-Put-PlotType ActiveLayoutObj acWindow)
(vla-PlotToFile PlotObj FileName)
(foreach o (list PlotObj ActiveLayoutObj ActiveDocObj AcadObj)
    (vlax-release-object o)
)
)

(PlotToFile
"DWG To PDF.pc3"
"ANSI_A_(11.00_x_8.50_Inches)"
(list (list 0 0) (list 100 100))
(strcat (getvar "DWGPREFIX") (getvar "DWGNAME") ".pdf")
)

aws 发表于 2024-9-7 09:44:07

sandyvs 发表于 2024-9-6 17:24
http://bbs.xdcad.net/forum.php?mod=viewthread&tid=727578&highlight=%E9%80%9A%E7%94%A8%2B%E6%89%93%E5 ...

我滴天,跟天书一样。

qazxswk 发表于 2024-9-14 23:40:17

sandyvs 发表于 2024-9-6 17:24
http://bbs.xdcad.net/forum.php?mod=viewthread&tid=727578&highlight=%E9%80%9A%E7%94%A8%2B%E6%89%93%E5 ...

试了一下这个,输出文件时,好慢。

sandyvs 发表于 2024-9-19 09:01:01

qazxswk 发表于 2024-9-14 23:40
试了一下这个,输出文件时,好慢。

按说应该不会,应该是跟cad文件本身有关系吧

qazxswk 发表于 2024-9-19 22:50:03

sandyvs 发表于 2024-9-19 09:01
按说应该不会,应该是跟cad文件本身有关系吧

我找到解决办法了。谢谢你的源代码。
页: [1]
查看完整版本: 关于设定打印机参数