Jump to content

Recommended Posts

Posted

For x = 0 To Drawing.Layouts.Count - 1

 

Hi Karl, that looks good!

That should do it

 

The alternative would be to declare a variable for an acad layout, then loop straight through the layouts in paper space.

Now, you don't have to worry about filtering out Model Space when you plot.

 

  Dim layout as AcadLayout

  For Each layout in ThisDrawing.PaperSpace
       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.PlotViewportBorders = False
       Layout.PlotViewportsFirst = True
       Layout.CanonicalMediaName = SIZE    ' CALL SIZE
       Layout.PaperUnits = acInches
       Layout.StandardScale = PSCALE       ' CALL PSCALE
       Layout.ShowPlotStyles = False
       Layout.ScaleLineweights = True
       Layout.CenterPlot = True
       Drawing.Plot.NumberOfCopies = 1
       Drawing.Regen acAllViewports
       Drawing.Plot.PlotToDevice
     Next layout

     Set Layout = Nothing
    

 

Just a thought

 

ML

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • CmdrDuh

    9

  • ML0940

    7

  • -KarL-

    6

  • veranco

    1

Top Posters In This Topic

Posted Images

Posted

With the code you used, you could also say:

 

For x = 0 To Drawing.Layouts.Count - 1 
Msgbox (x & "layouts have been successfully created")

  • 1 year later...
Posted
this should get you started. Are you wanting to hard code your paper size or pass it as an argument?

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.PlotViewportBorders = False
     Layout.PlotViewportsFirst = True
     Layout.CanonicalMediaName = SIZE    ' CALL SIZE
     Layout.PaperUnits = acInches
     Layout.StandardScale = PSCALE    'CALL PSCALE
     Layout.ShowPlotStyles = False
     ThisDrawing.Plot.NumberOfCopies = 1

     Layout.CenterPlot = True
     If SIZE = "ARCH_expand_C_(24.00_x_18.00_Inches)" Then
           Layout.ScaleLineweights = True
     End If
     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

 

Dear members

Currently I'm trying to use this code to implement PDFCreator to print automaticly the used viewports as pdf-files.

I encountered some difficulties but I keep on having two problems:

I can't find a way to print it without the error of the named plotstyles, I always use a ctb file for my plotstyles, and that always results in an error.

 

Second problem is not so specific: I would want to replace the print function with te one I just made, so that every viewport, when printed, creates a pdf file as well. The double function required to do that already exists, the problem is how can I override the print/plot function (the OK-button in the plot-window).

 

Thanks in advance!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...