muck Posted December 16, 2009 Share Posted December 16, 2009 Is there a way to plot to a pdf file with the same name as the drawing in AutoCAD VBA? Thank you, Quote Link to comment Share on other sites More sharing options...
fixo Posted December 16, 2009 Share Posted December 16, 2009 Is there a way to plot to a pdf file with the same name as the drawing inAutoCAD VBA? Thank you, This one is not mine I don't remeber where I found it Pehaps on this forum 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'~ Quote Link to comment Share on other sites More sharing options...
muck Posted December 17, 2009 Author Share Posted December 17, 2009 How do you control model/paper space printing & layouts? Thank you, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.