How can scripts or Lisp be used to manipulate windows ?

Discussion in 'AutoCAD' started by treyr, Sep 17, 2004.

  1. treyr

    treyr Guest

    I have hundreds Acad drawings that need new "page setup" from the "plot dialog" box changed. We have a new plotter and these drawings need to be updated with the new plot settings. The problem is that I do not know of a way to manipulate the "page setup" up from strictly the command prompt, therefore I don't' know of a way to use scripts, Lisp, or anything else to control dialog boxes to access commands that do not have a command prompt equivalent. Does anyone have any suggestions on how to address this specific problem or know of a general way to manipulating dialog boxes ?
     
    treyr, Sep 17, 2004
    #1
  2. treyr

    Chip Harper Guest

    -plot at the command line ...write down all your responses ... you want to
    enter YES to save changes and NO to plot at the end...then save the
    file...then create a script or lisp to repeat using the values you just
    entered.
     
    Chip Harper, Sep 17, 2004
    #2
  3. treyr

    Jason Rhymes Guest

    Save your new plotter setup in your .dwt file then use this menumacro

    ^C^C.-PSETUPIN "yourtemplate.dwt" "*"
     
    Jason Rhymes, Sep 17, 2004
    #3
  4. treyr

    Dave Jones Guest

    dialog" box changed. We have a new plotter and these drawings need to be
    updated with the new plot settings. The problem is that I do not know of a
    way to manipulate the "page setup" up from strictly the command prompt,
    therefore I don't' know of a way to use scripts, Lisp, or anything else to
    control dialog boxes to access commands that do not have a command prompt
    equivalent. Does anyone have any suggestions on how to address this
    specific problem or know of a general way to manipulating dialog boxes ?

    this might help you get started. You can alter and autoload this and then
    can run this from a script to add the page setup to all of your drawings. It
    adds my HP1050 and LaserJet 4V pagesetups from a template file that contains
    all of my page setups to my DDP_1 layout tab and makes the HP1050 page setup
    current.


    (defun C:add1050C ()
    (setq tablist (layout-list))
    (setq gettab (car (member "DDP_1" tablist)))
    (if (eq gettab "DDP_1");if the DDP_1 layout tab exists
    (progn
    (setvar "FILEDIA" 0);turn off dialogs
    (setq expert (getvar "EXPERT"));save sysvar
    (setvar "EXPERT" 2);eliminate the annoying dialog if a PS already
    exists
    (setq psetuplist "HP1050C-ArchD,11x17L");list of pagesetups
    (command "PSETUPIN" "PageSetupMaster.dwt" psetuplist);import page
    setups
    (command "-PLOT" "N" "DDP_1" "HP1050C-ArchD" "HP1050C.pc3" "N" "Y" "N")
    ;make the HP1050C Page Setup current in the DDP_1 tab
    (setvar "FILEDIA" 1);turn on dialogs
    (setvar "EXPERT" expert);restore sysvar
    );progn
    );if
    (princ)
    );end defun add1050C

    Dave
    DDP
     
    Dave Jones, Sep 17, 2004
    #4
  5. And do not forget to turn FILEDIA to 0 and then back to 1

    I actually run a LISP routine DAPS to Delete All PageSteups and
    then -PSETUPIN from a file I call PLOT.DWT

    (defun c:daps ()
    (vl-load-com)
    (vlax-for ps (vla-get-plotconfigurations
    (vla-get-activedocument
    (vlax-get-acad-object)))
    (vla-delete ps)
    )
    )
     
    Tracy W. Lincoln, Sep 18, 2004
    #5
  6. treyr

    treyr Guest

    Thanks so much for your replies. This was exactly what I was looking for. It seems that the "psetupin" command is the command line equivalent for interacting with the plot dialog box. Which leads me to the general question, do all dialog boxes have a command line equivalent? (such as: "-psetupin" for "Page Setup Name" in the plot dialog or "-xref" for the "Xref Manager") Because it seems that there is no way of interacting with dialog boxes with any type of code. If there is no command line equivalent for a dialog box, then is it impossible to work with the feature in that dialog box?

    Thanks again,
    treyr
     
    treyr, Sep 22, 2004
    #6
  7. treyr

    treyr Guest

    Thanks for the input I like the approach, but i'm not sure how the routine that you have shown deletes the previous page setups. I don't recognize any of the commands used thought out the LISP routine. (I would really like to incorporate the deletion)

    Thx
     
    treyr, Sep 22, 2004
    #7
  8. treyr

    Dave Jones Guest

    that you have shown deletes the previous page setups. I don't recognize any
    of the commands used thought out the LISP routine. (I would really like to
    incorporate the deletion)
    save the daps.lsp as a text file somewhere, preferably in your Acad search
    path. Use Appload to load the routine, then type DAPS at the command line.
    Your existing page setups in that drawing will be gone. If you want to run
    it in a script on multiple drawings before using another routine to psetupin
    new page setups just write a script like:

    open
    C:\WhereTheDrawingIs\DwgName.dwg
    daps
    whatever the command is to do your psetupin
    qsave
    close
    open
    so on and so forth

    there are many ways to automate the creation of script files, but, that's
    another subject
    Dave
    DDP
     
    Dave Jones, Sep 23, 2004
    #8
  9. Try setting FILEDIA to 0 in your script, and then use -PSETUPIN and then
    name the location of the server/drive/folder/file that you want to get the
    Page Setup from...

    Also note that an "\" in a script is a prompt whereas a "/" (both less
    "quotation marks) is what you need to privide to a macro or a script in
    order for it to address pathes...

    Lastly do not forget to reset FILEDIA back to 1
     
    Tracy W. Lincoln, Sep 23, 2004
    #9
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.