Listing of Page setup and/or output devices

Discussion in 'AutoCAD' started by per, Dec 29, 2004.

  1. per

    per Guest

    Hi there,
    I am looking for a way within VisualLISP to extract a list of Page setups
    within a drawing and/or a list of available output print devices. If there
    is someone with the knowledge to help me out, I would greatly appreciate it.
    Thank you in advance for your help.
     
    per, Dec 29, 2004
    #1
  2. per

    pablorico21 Guest

    It's a idea, this routine bellow find the main printter installed in Pc:

    (DEFUN PRINTTER_FROM_PC (/ ACFROMC PRINTTERS_IN_THIS_PC PRINTTERS_IN_THIS_PC PRINTTER_L
    PRINTTERS_FINAL)
    (SETQ ACFROMC (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
    (SETQ PRINTTERS_IN_THIS_PC
    (VLAX-SAFEARRAY->LIST
    (VLAX-VARIANT-VALUE
    (VLA-GETPLOTDEVICENAMES (VLA-GET-ACTIVELAYOUT ACFROMC)))))
    (FOREACH PRINTTER_L PRINTTERS_IN_THIS_PC
    (IF (AND (NOT (WCMATCH PRINTTER_L "*.pc3")) (/= PRINTTER_L "None"))
    (SETQ PRINTTERS_FINAL (CONS PRINTTER_L PRINTTERS_FINAL))))
    (car PRINTTERS_FINAL))
    ;-----------------------------------------
     
    pablorico21, Dec 30, 2004
    #2
  3. Phillip,

    Here are some toolbox functions that I use. The first
    one will get the names of the pagesetups defined in the
    specified document, the other three are used to get
    the plot device information (IIRC, the functions for
    plot devices came from Doug Broad)


    ; function to determine what plotconfigurations
    ; are defined in the specified document
    ; [document] - document object
    ; return: list of strings or nil
    ; (getPlotConfigNames (vla-get-activedocument (vlax-get-acad-object)))
    (defun getPlotConfigNames (document / names)
    (reverse
    (vlax-for x (vla-get-plotconfigurations document)
    (setq names (cons (vla-get-name x) names))
    )
    )
    )

    ; obtain a list of available printers/plotters
    ; return: list of strings or nil
    (defun getPlotDevices (/ hide layout)
    (if (setq hide (= "1" (getenv "HideSystemPrinters")))
    (setenv "HideSystemPrinters" "0") )
    (setq
    layout
    (vla-get-activelayout
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (vla-refreshplotdeviceinfo layout)
    (if hide (setenv "HideSystemPrinters" "1"))
    (vlax-invoke layout 'getplotdevicenames)
    )

    ; retrieve a list of .pc3 devices
    ; file dependencies
    ; getPlotDevices.lsp
    (defun getPC3Devices (/ lst)
    (if (setq lst (getPlotDevices))
    (vl-remove
    "None"
    (vl-remove-if-not
    '(lambda (x) (wcmatch x "*.pc3"))
    lst
    )
    )
    )
    )

    ; retrieve a list of system plot devices
    ; file dependencies
    ; getPlotDevices.lsp
    (defun getSystemPlotDevices (/ lst)
    (if (setq lst (getPlotDevices))
    (vl-remove
    "None"
    (vl-remove-if
    '(lambda (x) (wcmatch x "*.pc3"))
    lst
    )
    )
    )
    )
     
    Jason Piercey, Dec 30, 2004
    #3
  4. per

    per Guest

    Very good, thank you for your time. I appreciate your help.
     
    per, Dec 31, 2004
    #4
  5. per

    per Guest

    Excellent,
    Thank you very much Jason and have a very happy and prosperous New Year.
    --
    Phillip

     
    per, Dec 31, 2004
    #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.