+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Super Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    703

    Default Plotting drawing page setups in AutoCAD

    Registered forum members do not see this ad.

    AutoCAD 2008

    The following code will not work because of
    ThisDrawing.Plot.PlotToDevice (ab)
    I think ab is the wrong parameter.

    So How can this code be modifed to print existing drawing
    page setups?


    Private Sub CommandButton1_Click()
    Dim ab As String
    ab = ComboBox1.Value
    ThisDrawing.Plot.PlotToDevice (ab)
    End Sub
    Private Sub UserForm_Initialize()
    Dim a As AcadPlotConfiguration
    For Each a In ThisDrawing.PlotConfigurations
    ComboBox1.AddItem (a.Name)
    Next
    End Sub

  2. #2
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Location
    Philadelphia, Pa.
    Posts
    407

    Default

    Hey Muck

    I am not quite sure what the end result of what you are trying to do is; can you give me a little more?

    May be I can help you

    M

  3. #3
    Super Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    703

    Default Trying to make a batch plot that uses plot device.

    I really don't like the AutoCAD publish command so I am working on
    a batch plot program that is more user friendly. I made one years
    ago for R14 using plot send command. I modified for release 2008 but
    it is not very good using plot send.
    So I am looking plot device comand to see how it works.
    I am have the following code with plot.device working.

    Private Sub CommandButton1_Click()
    Dim objPlotConfigs As AcadPlotConfigurations
    Dim objPlotConfig As AcadPlotConfiguration
    'Dim objLayout As AcadLayout
    'Dim strLayoutList() As String
    'Dim intCount As Integer
    'Dim objPlot As AcadPlot
    Dim ab As String
    ab = ComboBox1.Value
    Set objPlot = ThisDrawing.Plot
    'objPlot.SetLayoutsToPlot (ab)
    Set objPlotConfigs = ThisDrawing.PlotConfigurations
    Set objPlotConfig = objPlotConfigs.Add(ab, True)
    UserForm1.hide
    ThisDrawing.Plot.PlotToDevice 'Works at home but not at the office
    'ThisDrawing.Plot.PlotToDevice (Canon2780)?? does not work at office
    UserForm1.Show
    End Sub

    Private Sub UserForm_Click()

    End Sub
    Private Sub UserForm_Initialize()
    Dim a As AcadPlotConfiguration
    For Each a In ThisDrawing.PlotConfigurations
    ComboBox1.AddItem (a.Name)
    Next
    End Sub


    Seems like the plot device command is much slower at the office for some
    reason. It slows things down. I don't know if there is a way around that.
    Thank you,

  4. #4
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Location
    Philadelphia, Pa.
    Posts
    407

    Default

    Hey Muck

    Code:
    Private Sub CommandButton1_Click()
    Dim ab As String
    ab = ComboBox1.Value
    ThisDrawing.Plot.PlotToDevice (ab)
    End Sub
    Private Sub UserForm_Initialize()
     
    Dim a As AcadPlotConfiguration
    For Each a In ThisDrawing.PlotConfigurations
    ComboBox1.AddItem (a.Name)
    Next
    End Sub
    Is your combo box getting populated correctly with all the plotconfigs on initialization?

    I have not used the PlotToDevice method.

    I recall trying to so something with PlotConfigs and VBA and it was not very easy to make it work.

    M

  5. #5
    Super Member
    Using
    not specified
    Join Date
    Feb 2006
    Posts
    703

    Default

    Yes the combo box is populated correctly.
    With that code it usually stop at plot at ThisDrawing.Plot.PlotToDevice (ab)
    In think ab is invalid for the command

  6. #6
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    May 2008
    Location
    Philadelphia, Pa.
    Posts
    407

    Default

    Hi Muck

    Well, with ab.; it looks like you are just using that variable to pass the plotconfig name through to the plot device method.
    So, I am not so sure it is that; let's see here:

    Code:
    Private Sub CommandButton1_Click()
     Dim ab As String
     ab = ComboBox1.Value
     ThisDrawing.Plot.PlotToDevice (ab)
    End Sub
    
    Private Sub UserForm_Initialize()
     Dim a As AcadPlotConfiguration
     For Each a In ThisDrawing.PlotConfigurations
      ComboBox1.AddItem (a.Name)
     Next
    End Sub
    On Initialization, it looks like you are just populating the combo box with the plot config names.

    When the button is clicked, you are telling the plotter to plot with the chosen plotconfig.

    I haven't tried it but from here, the code looks good.

    Muck, are you sure it is not one of your plotconfigs?

    Try to see if your plotconfig is OK.
    If not, we can look at it closer.
    Unfortunately I have not used this method so I don't have code to refer to but again, the code you posted looks good; I don't see anything wrong with the variable ab.

    hmmm, wait a minute

    In your loop, on initialization there may be a problem
    I looked and in the AcadPlotConfigurations object, I don't see a name method; there is however an item method.
    So, perhaps you need to do something like this;

    Code:
    Private Sub UserForm_Initialize()
     Dim PltConfigs As AcadPlotConfigurations
     PltConfigs = ThisDrawing.PlotConfigurations
     
    With ComboBox1.AddItem
      PltConfigs.Item ("PlotconfigName")
      PltConfigs.Item ("PlotconfigName")
      PltConfigs.Item ("PlotconfigName")
    End With
      
    End Sub
    So, for each plot config name, try listing each one individually in a with statement as opposed to the using the for each loop.

    We may still be able to use the For each loop but for now, see if this does it.

    If that gets resolved, it looks like the code in the command button, including the ab variable should be OK.

    Let me know
    M

  7. #7
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Apr 2006
    Location
    Los Angeles
    Posts
    65

    Default

    Registered forum members do not see this ad.

    Canon2780- help says "The full path and file name of the PC3 file to use instead of the current configuration"
    I haven't used that option but prefer to make the the config active (oLayout.CopyFrom pc)

    Set oPlot = ThisDrawing.Plot
    oPlot.SetLayoutsToPlot LayoutList
    oPlot.PlotToDevice

Similar Threads

  1. Applying page setups
    By Bogbadbob658 in forum AutoCAD General
    Replies: 1
    Last Post: 17th Nov 2007, 09:21 pm
  2. Loading page setups from external drawing
    By Autodesk in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 16th Feb 2007, 02:11 am
  3. Using AutoCAD 2007 VBA to load & use Page Setups.
    By muck in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 23rd Jan 2007, 10:59 pm
  4. Can AutoCAD VB be use to import page setups
    By muck in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 19th Jan 2007, 04:25 pm
  5. Page Setups
    By alexf4 in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 13th Sep 2006, 01:48 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts