;| PSFSV.LSP: PaperSpace Final Save by Paul Kirill 10/27/03 c2003 KDCAD, inc. This routine is given freely and may be freely distributed with the condition that all KDCAD copyright and contact information be included. If you have any questions about KDCAD or would like to contract for additional customization, please drop me a note at info@kdcad.com! If you need any help with these LISP routines, please don't hesitate to drop a note in our forums at www.kdcad.com,,, Notes: This routine is a modified version of Final_Save.lsp. In this version, there are two command formats - Alert Mode and Quiet Mode. Alert Mode: From the command line, PSFSV will perform a Final Save on all Layout Tabs - zooming to extents on each tab and parking on the first layout before saving. In this mode, an alert box pops up to tell you that the drawing has not been saved properly and another to tell you its done. Quiet Mode: From another routine or script, you can call QPSFSV ('Q' for Quietmode) which will run PSFSV without the alerts. If a drawing has not been saved properly, the final "QSAVE" is skipped and the drawing name is written out to a file that you can check after your batch has run.|; (defun C:PSFSV () (PSFSV 0) (princ "\nPaperSpace Final Save - KDCAD c2003") (princ) ) (defun QPSFSV ();QUIETMODE VERSION (PSFSV 1) (princ "\nPaperSpace Final Save - KDCAD c2003") (princ) ) (defun check_file_name (QUIETMODE / FILENAME FLEN FNUM) (setq FSVTEMPDIR "C:/Temp/");This is the default directory for the ;failed saves. Change it to suit your needs. (setq CDATE (rtos (getvar "cdate") 2 4) YEAR (substr CDATE 3 2) MONTH (itoa (atoi (substr CDATE 5 2))) DAY (itoa (atoi (substr CDATE 7 2))) ) (setq PDATE (strcat MONTH "/" DAY "/" YEAR)) (setq FILENAME (getvar "dwgname") FLEN (strlen FILENAME) FNUM (substr FILENAME 1 (- FLEN 5)) ) (if (= FNUM "Drawing") (progn (if (= QUIETMODE 0) (progn (alert "Drawing not saved in standard format! \n\n Save drawing in standard format \n before running Final Save." ) (vl-exit-with-value nil) (princ) ) (progn (if (findfile (strcat FSVTEMPDIR "PFSV_Failed.txt")) (setq W_A "A") (setq W_A "W") ) (setq f (open (strcat FSVTEMPDIR "PFSV_Failed.txt") W_A)) (write-line (strcat "Failed: " FILENAME " " PDATE) f ) (close f) ) ) ) (progn (command "qsave") (if (= QUIETMODE 0) (alert (strcat "All layouts have been Zoomed to Extents \nand drawing " FILENAME " has been saved." ) ) ) ) ) (princ) ) (defun PSFSV (QUIETMODE / layouts c) ;;---------------Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com (vl-load-com) (setq layouts (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)) ) c -1 ) (repeat (vla-get-count layouts) (setq lst (cons (setq c (1+ c)) lst)) ) (vlax-for lay layouts (setq lst (subst (vla-get-name lay) (vla-get-taborder lay) lst ) ) ) (setq LTLIST (reverse lst)) ;;^^^^^^^^^^^^^Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com (setq ZOOMLIST LST) (while ZOOMLIST (setvar "CTAB" (car ZOOMLIST)) (if (/= (getvar "CTAB") "Model") (C:VL) ) (command "ZOOM" "E") (setq ZOOMLIST (cdr ZOOMLIST)) ) (setvar "CTAB" (car (cdr LTLIST))) (CHECK_FILE_NAME QUIETMODE) ) (defun C:VL (/ VPLST) (setq VPLST (ssget "x" (list (cons 0 "viewport")))) (if (= (getvar "ctab") "Model") (princ "\n** Command not allowed in Model Tab **") (command "MVIEW" "lock" "on" VPLST "") ) (princ) )