deleting page setups

Discussion in 'AutoCAD' started by John Crocco, Dec 29, 2003.

  1. John Crocco

    John Crocco Guest

    I need to delete pagesetup via lisp. I automatically load them via
    acad2002.lsp routine, and have changed the names due to a new plotter and
    new routines. The old ones still remain in existing drawings. I want to to
    delete the current ones, or I can actually specify which ones to delete,
    then i can do psetupin to add new ones.

    Any easy way to do this?

    BTW, Heres the original code to see what has been done:

    ;Custom commands by John Crocco 10-17-01
    ;revised to use new config for hp750c 12-23-03
    ;inserts plot styles into current drawing
    (DEFUN PSETUPS (/ exprt)
    (setq exprt (getvar "expert"))
    (setvar "expert" 5);WAS 2
    ;FOR HP200 (if (wcmatch (getvar "platform") "*4.0*") (command "._-PSETUPIN"
    "j:/cc/template/plotconfig.dwt" "*"));FOR WINNT hp200
    ;FOR HP200 (if (wcmatch (getvar "platform") "*Version 5.1*") (command
    "._-PSETUPIN" "j:/cc/template/plotconfigxp.dwt" "*"));FOR WIN XP hp200
    ; (if (wcmatch (getvar "platform") "*4.0*") (command "._-PSETUPIN"
    "j:/cc/template/plotconfig750nt-test.dwt" "*"));FOR WINNT hp750c test mode
    ; (if (wcmatch (getvar "platform") "*Version 5.1*") (command "._-PSETUPIN"
    "j:/cc/template/plotconfig750xp-test.dwt" "*"));FOR WIN XP hp750c test mode
    (if (wcmatch (getvar "platform") "*4.0*") (command "._-PSETUPIN"
    "j:/cc/template/plotconfig750nt.dwt" "*"));FOR WINNT hp750c
    (if (wcmatch (getvar "platform") "*Version 5.1*") (command "._-PSETUPIN"
    "j:/cc/template/plotconfig750xp.dwt" "*"));FOR WIN XP hp750c
    (setvar "expert" exprt)
    );end psetups
    (if (/= (getvar "dwgprefix") "J:\\cc\\template\\")(PSETUPS));prevent psetups
    to load into the default psetups drawing and overwriting it
     
    John Crocco, Dec 29, 2003
    #1
  2. John Crocco

    Jeff Mishler Guest

    John,
    Not to sound like a broken record, but did you try searching this group for
    this answer? In Outlook Express I get 333 messages when searching for "page
    setup", and at least half of those discuss this issue........specifically ,
    the thread started by "Mike" on Sept. 3, 2003 entitled "deleting page setups
    per script?" has a good method as well as a few comments on that method.

    HTH,
    Jeff
     
    Jeff Mishler, Dec 29, 2003
    #2
  3. John Crocco

    jclaidler Guest

    (defun DelPageSetup ( Name / Cfgs)
    (setq
    Cfgs
    (vla-get-plotconfigurations
    (vla-get-activedocument
    (vlax-get-acad-object))))

    (cond
    ((vl-string-search "*" Name)
    (vlax-for x Cfgs
    (if (wcmatch (vla-get-name x) Name)
    (vla-delete x))))

    (T
    (vl-catch-all-apply
    '(lambda () (vla-delete (vla-item Cfgs Name)))))
    )

    (setq currentpsetup nil)

    (princ)

    )

    (delpagesetup)
     
    jclaidler, Dec 29, 2003
    #3
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.