Current PlotConfiguration

Discussion in 'AutoCAD' started by John Avitt, Mar 31, 2005.

  1. John Avitt

    John Avitt Guest

    How can I get the name of the current PlotConfiguration (i.e., the current
    Page Setup)?

    Thank you.

    John
     
    John Avitt, Mar 31, 2005
    #1
  2. John Avitt

    Ed Jobe Guest

    I havn't found that vba exposes that info, its just the current layout's
    settings. I use the attached lisp to return it to vba. You can then return
    it to vba from lisp with the following code. Note that vlax refers to a
    class file that should be available as a download if you search this forum.

    Public Function GetCurrentPlotConfig(LayoutName As String)
    'Returns the name of the current PlotConfig for the specified layout
    'Must do this though lisp because vba does not expose this property.
    '
    Dim vl As VLAX
    Dim strPC As String
    Set vl = New VLAX
    'make sure lisp function (CurrentPlotConfig) is loaded
    vl.EvalLispExpression ("(if (null CurrentPlotConfig)(load
    ""CurrentPlotConfig.lsp""))")
    strPC = "(CurrentPlotConfig """ & LayoutName & """)"
    strPC = vl.EvalLispExpression(strPC)
    Set vl = Nothing
    GetCurrentPlotConfig = strPC
    End Function
     
    Ed Jobe, Apr 1, 2005
    #2
  3. John Avitt

    Ed Jobe Guest

    oops forgot to attach the lisp.

    --
    ----
    Ed
    ----
     
    Ed Jobe, Apr 1, 2005
    #3
  4. John Avitt

    John Avitt Guest

    Thank you for your reply.

    One thing I have tried, unsuccessfully, is to set the USERS1 system variable
    from within AutoLISP to the name of the current configuration, then extract
    it in VBA with AcadDocument.GetVariable("USERS1"). I can't seem to get it to
    work. It always returns an empty string.

    Thank you.

    John
     
    John Avitt, Apr 1, 2005
    #4
  5. John Avitt

    John Avitt Guest

    I don't know what I was doing wrong, but it is working now. I use the
    SendCommand method to run an AutoLISP function that sets the USERS1 system
    variable to the current plot configuration name, then I use the GetVariable
    method to retrieve its value.

    Thank you.

    John
     
    John Avitt, Apr 1, 2005
    #5
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.