Author Topic: Page Setups  (Read 2116 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Page Setups
« on: October 24, 2004, 10:07:33 PM »
I don't know if I'm stupid or just dumb but I can't get this to work. I'm trying to plot an EPS file of modelspace limits so I can then pass it through ghostscript, making pdf files. However, when I run this code it doesn't change  any of the modelspace layout properties.

Code: [Select]

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
        PlotToEPS = False
    End If
End Function

Note: I use the "For Each Layout In ThisDrawing.Layouts" in case I never need to make this work with paperspace.


  • Guest
Page Setups
« Reply #1 on: October 27, 2004, 08:47:42 PM »
I'll be just as dumb and stupid, How do you use this?
I created a similar thing with scripts to plot create plots.

Is there an advantage of using this?

There is so much for me to learn...



  • Guest
Page Setups
« Reply #2 on: October 29, 2004, 08:51:53 PM »
I haven't had a chance to look at this recently but I think it's an error in my pc3 file and not in the code.

The reason I chose to do it this way instead of through plot scripts is this method will return true when it's completed which would allow me to continue with my code. Which now that I think about it probably won't work anyhow, I'll have to manually check for the file.


  • Guest
Re: Page Setups
« Reply #3 on: April 18, 2006, 03:55:02 PM »
Try tweaking your code with the lines in bold...

For Each Layout In ThisDrawing.Layouts
   If LCase(Layout.Name) = "model" Then
       With Layout
           .ConfigName = "PostScript.pc3"

Not sure why we need to refresh it twice, but it was the only way I could get my plot routines to work properly.


  • Guest
Re: Page Setups
« Reply #4 on: April 18, 2006, 04:00:49 PM »
Woops. Nevermind that won't work. I was thinking of something else...


  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Page Setups
« Reply #5 on: April 18, 2006, 04:44:55 PM »
this is what I use
Code: [Select]
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.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
    ThisDrawing.Regen acAllViewports
    Set Layout = Nothing
    Exit Sub

    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
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second