Convert dwg to pdf on AutoCAD

旧巷老猫 提交于 2019-12-25 02:46:40

问题


Hi how can I Plot to Pdf my AutoCAD drawing using VBA? I Tried

Sub PlotToPdf()
ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"
Dim plotFileName As String
plotFileName = "Z:\USERS\KweziM\PROJECT S\MyPlot.pdf"

Dim result As Boolean

result = ThisDrawing.Plot.PlotToFile(plotFileName)
End Sub

But this does not work.


回答1:


That last line should be a subroutine call, not a function call... it should look like this

ThisDrawing.Plot.PlotToFile plotFileName

You do not need the result variable.




回答2:


try this:

Public Sub VBAplot()
    Dim currentplot As AcadPlot
    Set currentplot = ThisDrawing.Plot

    ThisDrawing.ActiveLayout.ConfigName = "PDFCreator" ' Your plot device.
    ThisDrawing.ActiveLayout.CanonicalMediaName = "A4"

    ThisDrawing.ActiveLayout.StandardScale = acScaleToFit
    ThisDrawing.Application.ZoomExtents
    currentplot.PlotToDevice


End Sub


来源:https://stackoverflow.com/questions/47435510/convert-dwg-to-pdf-on-autocad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!