redefine open

Discussion in 'AutoCAD' started by c.prettyman, Jan 12, 2004.

  1. c.prettyman

    c.prettyman Guest

    Is it possible to redefine the "Open" command so that ACAD uses "Recover" instead?
     
    c.prettyman, Jan 12, 2004
    #1
  2. c.prettyman

    Paul Turvill Guest

    For what purpose?
    ___

    instead?
     
    Paul Turvill, Jan 12, 2004
    #2
  3. c.prettyman

    c.prettyman Guest

    I have a whole directory, with many subdirectories, in which every drawing seems to have been somehow tagged as needing to be recovered. I've done a few manuyally, and so far, the audits find no errors - they just need to be recovered, not opened, then saved, and everything is fine.

    So, I was thinking to run them through Smartpurger, to just recover, purge and save. But I don't see recover as an option in Smartpurge, so I was wondering if I could redefine the command on the machine that runs smartpurge in order to fool it into doing what I want. Now that I think about it, it may not work, because the recover process may want an extra keybard entry or two, but that is what I was originally thinking.

    CP
     
    c.prettyman, Jan 12, 2004
    #3
  4. c.prettyman

    John Crocco Guest

    Below is a lisp file I made(with help of this newsgroup a while ago) to do
    similar to what your asking. I load it, run it, and type in the path, and
    it recovers every drawings, purges, audits, and resaves all drawings in that
    directory. You can do it for a whole directory unattended on another machine
    while doing something else.

    You will need to modify the lisp to suit your needs, like the directory
    defaults, prompts, scriptfilenames, etc.

    ;Custom commands by John Crocco 12-16-01
    ;Run this routine in 2002 to recover, purge, audit, and save all drawings in
    the directory.
    ;
    (defun C:RECOV2002 ( )
    (WriteFindImageScript)
    (princ)
    )
    (defun WriteFindImageScript ( / )
    (setq path "j:/cc/")
    (Prompt "Enter directory or directory/subdirectory ie:3044 or 3044/dwgs")
    (write-line "")
    (setq dir (getstring "Directory name under j:\cc\ ?"))
    (setq pathname (strcat path dir "/"))
    (setq files (vl-directory-files pathname "*.dwg" 0))
    (setq scriptfilename "j:/cc/conv/conv2.scr")
    (setq filedescriptor (open scriptfilename "w"))
    (setq counter 0)
    (repeat (length files)
    (write-line "recover" filedescriptor)
    (setq drawingfile (strcat pathname (nth counter Files)))
    ; (write-line drawingfile filedescriptor)
    (write-line (strcat "\"" drawingfile "\"") filedescriptor)
    (write-line "" filedescriptor)
    (write-line "purge" filedescriptor)
    (write-line "all" filedescriptor)
    (write-line "*" filedescriptor)
    (write-line "N" filedescriptor)
    (write-line "audit" filedescriptor)
    (write-line "y" filedescriptor)
    (write-line ".save" filedescriptor)
    ; (write-line ".saveas" filedescriptor)
    ; (write-line "2000" filedescriptor) ;saveas 2000 for 2002 format
    (write-line "" filedescriptor)
    ; (write-line "y" filedescriptor)
    (setq counter (1+ counter))
    )
    (close filedescriptor)
    (command "script" scriptfilename)
    )

    --
    John Crocco
    Cartland Kraus Engineering Ltd.
    instead?
     
    John Crocco, Jan 12, 2004
    #4
  5. c.prettyman

    Paul Turvill Guest

    Write a script.
    ___

    seems to have been somehow tagged as needing to be recovered. I've done a
    few manuyally, and so far, the audits find no errors - they just need to be
    recovered, not opened, then saved, and everything is fine.
    and save. But I don't see recover as an option in Smartpurge, so I was
    wondering if I could redefine the command on the machine that runs
    smartpurge in order to fool it into doing what I want. Now that I think
    about it, it may not work, because the recover process may want an extra
    keybard entry or two, but that is what I was originally thinking.
     
    Paul Turvill, Jan 13, 2004
    #5
  6. c.prettyman

    BTO Guest

    Hi John,
    with (setq files (acad_strlsort (vl-directory-files pathname "*.dwg")))

    you will get files sorted by name, usefull when script crash.

    Another point is to use qaflags set to 2 : otherwise in certain cases it is
    necessary to use enter key which inevitably stops script.

    sincerely
    Bruno Toniutti

    (sorry for my english level)
     
    BTO, Feb 10, 2004
    #6
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.