A VBA Newbie

Discussion in 'AutoCAD' started by John, Dec 14, 2004.

  1. John

    John Guest

    Hello everyone,

    I'm tryting to learn VBA and I have some experience in Lisp. I'm playing
    with VBA from last few weeks so I think i got some basic stuff. here is my
    first CODE in VBA.

    Public Sub testforplot()
    Dim pagesetups As AcadPlotConfigurations
    Dim pagesetup As AcadPlotConfiguration
    Dim newpage1 As AcadPlotConfiguration
    Set pagesetups = ThisDrawing.PlotConfigurations
    Set newpage1 = ThisDrawing.PlotConfigurations.Add("test")
    newpage1.PlotRotation = ac270degrees
    newpage1.PlotType = acLayout
    newpage1.PlotWithPlotStyles = True
    newpage1.ConfigName = "Plotter.pc3"
    newpage1.StyleSheet = "test.STB"
    newpage1.StandardScale = ac1_1
    newpage1.CanonicalMediaName = "user636"
    newpage1.PlotWithLineweights = True
    newpage1.ScaleLineweights = True
    End Sub

    I know I can use WITH statement to replace all newpage1. My question is how
    to make plotconfigurations (name "test") active and assign with layouts?

    I'm trying to do this but with name

    If PlotConfigurations.count = 0 Then
    '*** Customize the new configuration to your satisfaction ***
    PlotConfigurations.Add "NEW_CONFIGURATION"
    End If

    Can i go by plotconfigurations name like this
    If PlotConfigurations.count = "test" Then
    '*** Customize the new configuration to your satisfaction ***
    PlotConfigurations.Add "NEW_CONFIGURATION"
    End If

    Thank you for your help. I will keep posting here becasue I'm VBA Newbie.
     
    John, Dec 14, 2004
    #1
  2. John

    TomD Guest

    If I remember correctly, you have to use the CopyFrom method of the layout
    to apply a PlotConfiguration's settings.

    .....that's how I've been doing it, anyway. (It seemed counterintuitive, at
    first.....at least to me.)
     
    TomD, Dec 14, 2004
    #2
  3. John

    John Guest

    Thank you for your reply

    what i really looking is, for example if you have few plotconfiguratios in
    this drawing and like to make one of them active....
     
    John, Dec 14, 2004
    #3
  4. John

    Ed Jobe Guest

    He gave that to you. :) Some code might make it clearer.

    If ThisDrawing.PlotConfigurations("SomePageSetup") Then
    ThisDrawing.ActiveLayout.CopyFrom ThisDrawing.PlotConfigurations
    "SomePageSetup"
    End If
     
    Ed Jobe, Dec 14, 2004
    #4
  5. John

    John Guest

    Thanks, Yes, he gave to me but I'm new so I get little slow...:) And i got
    confuse about this "copyfrom"...... I was thinking that statement something
    like this activeplotfiguration = "test". anyway againg thanks for your help.

    John
     
    John, Dec 15, 2004
    #5
  6. John

    TomD Guest

    help.

    Sorry about the lack of info, John. I'll take full blame for that post not
    being clear enough. ;)
     
    TomD, Dec 15, 2004
    #6
  7. John

    Ed Jobe Guest

    No problem. You can also look up CopyFrom in help for an example and what
    other objects use this method.
     
    Ed Jobe, Dec 15, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.