2 回答

TA贡献1871条经验 获得超8个赞
我认为最好的方法是运行 command _-PLOT,并使用虚拟 PDF 绘图仪。 您可以在这里找到更多信息。运行命令你可以使用:
acad.doc.SendCommand("_-PLOT" paramerets )
其中paramerets定义纸张大小,绘图区域等。
我在 python 中没有任何示例,只有 LISP。我希望你能处理翻译。所以最简单的样本可能是:
(setq parameters (list "_n" layoutName "" "PDFCreator" "_n" "_n" "_y")
凡layoutName在我的情况下,变量layoutName被读取BE迭代每个布局。在这种情况下,所有选项都将是默认的 - 您需要在绘图窗口中初始化配置并使用按钮[Apply to Layout]。
更复杂的例子可能是:
(setq parameters (list
"_y" ; detailed configuration
"Layout1" ; Layout name
"PDFCreator" ; ploter name
"A4" ; page size
"" ; drawing units
"" ; drawing orientation
"" ; plot upside-down
"_w" ; plot area - window
(strcat (rtos(car P1)) "," (rtos(cadr P1))) ; P1 and P2 are points ( three elemenets list of coordinates as real value ))
(strcat (rtos(car P2)) "," (rtos(cadr P2))) ; we need to convert real values to strings
"" ; drawing scale
"" ; plot offset
"" ; use plot style table
"" ; plot styme name
"" ; Lineweight
"" ; Lineweight scale
"" ; plot paperspace first
"" ; plot paperspace objects
"" ; save to file ( *.plt)
"_n" ; save changes to page configuration
"_y" ; confirm
)

TA贡献1805条经验 获得超10个赞
如果您想导出为 PDF 或 PNG,这是不同的。
对于 PDF,在我看来,最好的方法是使用虚拟绘图仪,例如 PDFCreator。因为您需要设置纸张大小等等。
但是对于.PNG
您可以使用 command _Export
。默认它会显示窗口保存对话框,但如果您将系统变量设置FILEDIA
为0
,对话框将被禁用,您可以仅使用命令行导出。请记住最后将 FILEDIA 设置为旧值。在另一种情况下,它会让你非常不高兴;)
添加回答
举报