redefine open

c.prettyman

Usenet Archive
Joined
Jul 21, 2003
Messages
22
Reaction score
0
Is it possible to redefine the "Open" command so that ACAD uses "Recover" instead?
 
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
 
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)
)

c.prettyman said:
Is it possible to redefine the "Open" command so that ACAD uses "Recover"
instead?
 
Write a script.
___

c.prettyman said:
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.
 
Hi John,
(setq files (vl-directory-files pathname "*.dwg" 0))

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)
 

Latest threads

Back
Top