Print Layout LISP/Active X Problem

Discussion in 'AutoCAD' started by bellenoit, Jul 13, 2004.

  1. bellenoit

    bellenoit Guest

    I wrote this lisp (with alot of help from here!) to delete all the Pagesetups and Layout tabs on our drawings then reset them to our defaults... can anyone tell me how to get this thing to run more silently (it flashes and echos on the command line) I'm figuring I missed something!

    Thanks!!!

    ;; *** Deletes Page Setups

    (defun Delset ()
    (vl-load-com)
    (vlax-for y (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
    (if (/= "Model" (vla-get-name y))(vla-delete y))
    )
    )
    (Delset)


    ;; *** Deletes Page Layouts

    (defun DelTabs ()
    (vl-load-com)
    (vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
    (if (/= "Model" (vla-get-name x)) (vla-delete x))
    )
    )
    (deltabs)


    ;; *** Calls in current layout tabs based on size ***
    ;; *** Adds Default Setups and sets 'Print' as default ***

    (setq a (ssget "X"
    '((-4 . "<OR")
    (-4 . "<AND")
    (0 . "Insert")
    (2 . "B-SIZE")
    (-4 . "AND>")
    (-4 . "<AND")
    (0 . "Insert")
    (2 . "C-SIZE")
    (-4 . "AND>")
    (-4 . "<AND")
    (0 . "Insert")
    (2 . "C-SIZE-H")
    (-4 . "AND>")
    (-4 . "<AND")
    (0 . "Insert")
    (2 . "CP-SIZE")
    (-4 . "AND>")
    (-4 . "<AND")
    (0 . "Insert")
    (2 . "D-SIZE")
    (-4 . "AND>")
    (-4 . "OR>"))
    )
    )
    (setq b (entget (ssname a 0)))
    (setq blkname (cdr (assoc 2 b)))
    (if (= (strcase blkname T) "b-size")(command "layout""T""BBraun B-Size-2005.dwt""Plot"))
    (if (= (strcase blkname T) "b-size")(command "-PSETUPIN" "BBRAUN B-SIZE-2005.DWT" "*"))
    (if (= (strcase blkname T) "c-size")(command "layout""T""BBraun C-Size-2005.dwt""Plot"))
    (if (= (strcase blkname T) "c-size")(command "-PSETUPIN" "BBRAUN C-SIZE-2005.DWT" "*"))
    (if (= (strcase blkname T) "c-size-h")(command "layout""T""BBraun C-Size-H-2005.dwt""Plot"))
    (if (= (strcase blkname T) "c-size-h")(command "-PSETUPIN" "BBRAUN C-SIZE-H-2005.DWT" "*"))
    (if (= (strcase blkname T) "d-size")(command "layout""T""BBraun D-Size-2005.dwt""Plot"))
    (if (= (strcase blkname T) "d-size")(command "-PSETUPIN" "BBRAUN D-SIZE-2005.DWT" "*"))

    ;sets your PS current in Plot tab
    (command "-PLOT" "N" "Plot" "Print" "Default Windows System Printer.pc3" "N" "Y" "N")

    (vla-Delete(vla-Item(vla-Get-Layouts(vla-Get-ActiveDocument(vlax-Ge t-Acad-Object)))"Layout1"))

    (princ)
     
    bellenoit, Jul 13, 2004
    #1
  2. bellenoit

    John Scott Guest

    Have you tried adding (setvar "cmdecho" 0)? I am fairly new to lisp, so I am
    not sure if this will fix your problem or not. Just a guess.

    John

    Pagesetups and Layout tabs on our drawings then reset them to our
    defaults... can anyone tell me how to get this thing to run more silently
    (it flashes and echos on the command line) I'm figuring I missed something!
     
    John Scott, Jul 13, 2004
    #2
  3. bellenoit

    andywatson Guest

    bellenoit,
    John is right, any time you use the "command" function, you will get command prompt text.
    Before your first "command" call, insert the following lines...
    (setq oldCMDECHO (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    This saves the current value of the system variable CMDECHO, and then it sets the value to 0, bye bye command prompt text.
    After your last "command" call, reset the system variable to its previous setting....
    (setvar "CMDECHO" oldCMDECHO)
     
    andywatson, Jul 13, 2004
    #3
  4. bellenoit

    bellenoit Guest

    Thanks for the help!!!! that's one problem down!!!!!
     
    bellenoit, Jul 14, 2004
    #4
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.