Public Function PlotToEPS(OutputFile As String) As Boolean
Dim Layout As AcadLayout
Dim Plot As AcadPlot
Dim orig(0 To 1) As Double
orig(0) = 0
orig(1) = 0
For Each Layout In ThisDrawing.Layouts
If LCase(Layout.Name) = "model" Then
With Layout
.ConfigName = "PostScript.pc3"
.CanonicalMediaName = "ANSI_B_(17.00_x_11.00_Inches)"
.PaperUnits = acInches
.PlotType = acLimits
.StandardScale = acScaleToFit
.PlotOrigin = orig
.StyleSheet = "Ricoh.ctb"
.PlotHidden = True
.UseStandardScale = True
.PlotRotation = ac90degrees
.CenterPlot = True
End With
Set Plot = ThisDrawing.Plot
Plot.PlotToFile OutputFile, "PostScript.pc3"
Set Plot = Nothing
PlotToEPS = True
Else:
PlotToEPS = False
End If
Next
End Function
[/end]
Note: I use the "For Each Layout In ThisDrawing.Layouts" in case I never need to make this work with paperspace.
For Each Layout In ThisDrawing.Layouts
If LCase(Layout.Name) = "model" Then
With Layout
.RefreshPlotDeviceInfo
.ConfigName = "PostScript.pc3"
.RefreshPlotDeviceInfo
...
Public Sub SetupAndPlot(ByRef Plotter As String, CTB As String, SIZE As String, PSCALE As String, ROT As String)
Dim Layout As AcadLayout
On Error GoTo Err_Control
Set Layout = ThisDrawing.ActiveLayout
Layout.RefreshPlotDeviceInfo
Layout.ConfigName = Plotter ' CALL PLOTTER
Layout.PlotType = acExtents
Layout.PlotRotation = ROT ' CALL ROTATION
Layout.StyleSheet = CTB ' CALL CTB FILE
Layout.PlotWithPlotStyles = True
Layout.CanonicalMediaName = SIZE ' CALL SIZE
Layout.PaperUnits = acInches
Layout.StandardScale = PSCALE 'CALL PSCALE
Layout.ShowPlotStyles = False
ThisDrawing.Plot.NumberOfCopies = 1
Layout.CenterPlot = True
Layout.ScaleLineweights = False
Layout.RefreshPlotDeviceInfo
ThisDrawing.Regen acAllViewports
ZoomExtents
Set Layout = Nothing
ThisDrawing.Save
Exit_Here:
Exit Sub
Err_Control:
Select Case Err.Number
Case "-2145320861"
MsgBox "Unable to Save Drawing- " & Err.Description
Case "-2145386493"
MsgBox "Drawing is setup for Named Plot Styles." & (Chr(13)) & (Chr(13)) & "Run CONVERTPSTYLES command", vbCritical, "Change Plot Style"
Case Else
MsgBox "Unknown Error " & Err.Number
End Select
End Sub