Argh! I have developed an autosave PDFOut macro in VBA for DWGEditor, but I can NOT get the PDF to center on the page. Here is my script, with several options I have tried, to no avail:
Dim Dwg As DWGeditor.Document
Dim eMin As Point
Dim eMax As Point
Dim PlotMgr As DWGeditor.PlotManager
Dim wDwg As Long
Dim hDwg As Long
Sub AutoPDF()
Set Dwg = DWGeditor.ActiveDocument
Set PlotMgr = DWGeditor.PlotManager
Dwg.ActiveViewport.ZoomExtents
Dwg.SetVariable "LIMCHECK", 0
Set eMin = Dwg.GetVariable("EXTMIN")
Set eMax = Dwg.GetVariable("EXTMAX")
If (eMax.x - eMin.x) > (eMax.y - eMin.y) Then
wDwg = 10.5
hDwg = 8
Else
wDwg = 8
hDwg = 10.5
End If
Dwg.Layers.Item("BORDER").Color = vicWhite
Dwg.Layers.Item("TEXT").Color = vicWhite
Dwg.Regen vicAllViewports
'===Problem snippet: I want to use Center On Page, but I can settle with OriginX/Y as well...
PlotMgr.CenterOnPage = 1 'What is the correct variable here?
PlotMgr.PlotProperties.OriginX = 0.5
PlotMgr.PlotProperties.OriginY = 0.5
'==================
Rev.Show 'Shows dialog box to enter Rev level in...
fPath = VBA.Left(Dwg.FullName, Len(Dwg.FullName) - 4) & " REV " & Rev.cRev.Text & ".PDF"
Dwg.PDFOut fPath, wDwg, hDwg, vicInches, Dwg.ActiveLayout.Name
End Sub
Does anyone have an idea why I can't center the PDF? This is my first attempt with DWGEditor API. Thanks!!
SolidworksApi macros