Here is a little AutoLISP function you can use to Purge, Audit, Qsave, and copy a snapshot to an Archive sub-directory everytime you pause for a breath, stretch, or sip of water.
(defun
c:qa (/ bp bn dn dnbase dnext dp)
(command
"._-purge" "_Blocks" "*" "n"
"._-purge" "_SHapes" "*" "n"
"._-purge" "_Zero"
"._-purge" "_Empty"
"._-purge" "_Regapps" "*" "n"
"._audit" "y"
"._qsave"
)
(setq
;;Drawing file name
dn (getvar "dwgname")
dnbase
(vl-filename-base dn)
dnext
(vl-filename-extension dn)
;;Drawing folder with trailing (back) slash
dp (getvar "dwgprefix")
;;Backup sub-folder name
bp (strcat dp "Archive\\")
;;Backup file name including date and time stamp as yyyymmdd-hhmmss
bn
(strcat
dnbase "-"
(itoa (fix (getvar "cdate"))) "-"
(substr (itoa (+ 1000000 (fix (* 1000000 (rem (getvar "cdate") 1))))) 2)
dnext
)
)
(vl-mkdir bp)
(if (vl-file-copy (strcat dp dn) (strcat bp bn))
(princ (strcat "\nSnapshot " bn " copied to " bp))
)
(princ)
)
Revised 2009-11-20: Added leading zero to save time.
Revised 2010-09-24: Wrapped Lisp code for visibility.
2 comments:
very nice. thanks!
Thanks, Tom! This has saved my bacon several times, now!
Post a Comment