muck 发表于 2022-7-6 12:01:39

带VBA的Pdf批次

有没有办法打印到与中的图形同名的pdf文件
AutoCAD VBA?
非常感谢。

fixo 发表于 2022-7-6 12:41:52

 
这不是我的我不记得在哪里找到的
Pehaps在这个论坛上
 

Sub PDF()
Dim xymin As Variant
Dim xymax As Variant
Dim sysVarName As String
Dim varData As Variant
Dim blad As AcadLayout
Dim PlotXY(0 To 1) As Double
Dim i As Integer
Dim result As Boolean
On Error GoTo PDF_Error
Set blad = ThisDrawing.Layouts.Item(1)
ThisDrawing.ActiveLayout = blad
blad.ConfigName = "DWG To PDF.pc3"
blad.CanonicalMediaName = "ISO_A3_(420.00_x_297.00_MM)"
blad.PlotType = acExtents
blad.StandardScale = acScaleToFit
blad.CenterPlot = True
blad.ScaleLineweights = True
blad.StyleSheet = "acad.ctb"
blad.PlotWithPlotStyles = False
blad.PlotWithLineweights = False
PlotXY(0) = 0#
PlotXY(1) = 0#
sysVarName = "EXTMIN"
xymin = ThisDrawing.GetVariable(sysVarName)
sysVarName = "EXTMAX"
xymax = ThisDrawing.GetVariable(sysVarName)
If (xymax(0) - xymin(0)) > (xymax(1) - xymin(1)) Then
blad.PlotRotation = ac0degrees
Else
blad.PlotRotation = ac90degrees
End If
blad.PaperUnits = acMillimeters
result = ThisDrawing.Plot.PlotToFile(Replace(ThisDrawing.FullName, "dwg", "pdf"))
Exit Sub
PDF_Error:
MsgBox "Error PDF'ing Layout!", vbOKOnly, "Error"
End Sub

 
~'J'~

muck 发表于 2022-7-6 13:12:57

如何控制模型/图纸空间打印和布局?
非常感谢。
页: [1]
查看完整版本: 带VBA的Pdf批次