;;;Save Views including layer on/off/thaw/freeze/lock for a particular view in a ;;; new script file which the user specifies. Invoking the script file ;;; will return the layers to the same condition they were in when the ;;; script was made. In addition, a commented line is placed at the top ;;; of the script file indicating the file the script file was made from ;;; and date the script file was made on followed by the description the ;;; user specifies. ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 3-23-94 ;;;> EDITED: 04-08-1997 ;;; (defun C:SAVEDISP ( / outfn datf lay0 lay1 thawl strno onl strnn datm dwgp dwgn curdt) (setq strno 0) (setq strnn 0) (setq outfn (strcat (ustr 1 "\nOutput Filename (without extension) " nil "")".scr")) (while (if (findfile outfn) (setq outfn (strcat (ustr 1 "\nFile exists, New Output Filename (without extension) " nil "")".scr")) );if );while (setq datf (open outfn "w")) (setq *error* (close datf)) (setq datm (rtos (getvar "cdate") 2 6)) (setq dwgp (getvar "dwgprefix") dwgn (strcat (getvar "dwgname") ".DWG") curdt (strcat (substr datm 5 2) "-" (substr datm 7 2) "-" (substr datm 1 4) " " (substr datm 10 2) ":" (substr datm 12 2) ":" (substr datm 14 2)) );setq (if (>(strlen dwgn)8) (setq fndsc (strcat ";Display " dwgn " " curdt " " (ustr 1 "\nEnter Description " nil ""))) (setq fndsc (strcat ";Display " dwgp dwgn " " curdt " " (ustr 1 "\nEnter Description " nil ""))) );if (setq datf (open outfn "w")) (write-line fndsc datf) (setq lay0 (tblnext "layer" "T")) (if (eq 1 (rem (cdr (assoc 70 lay0)) 2)) (setq thawl (cdr (assoc 2 lay0))) (setq thawl "") );if (if (<(cdr (assoc 62 lay0))0) (setq onl (cdr (assoc 2 lay0))) (setq onl "") );if (while (setq lay1 (tblnext "layer")) (if (eq 1 (rem (cdr (assoc 70 lay1)) 2)) (setq thawl (strcat thawl "," (cdr (assoc 2 lay1)))) );if (if (> (strlen thawl) 200) (progn (setq strno (1+ strno)) (set (read (strcat "thaw" (itoa strno))) thawl) (setq thawl "") );progn );if (if (<(cdr (assoc 62 lay1))0) (setq onl (strcat onl "," (cdr (assoc 2 lay1)))) );if (if (> (strlen onl) 200) (progn (setq strnn (1+ strnn)) (set (read (strcat "on" (itoa strnn))) onl) (setq onl "") );progn );if );while (write-line ".layer T * " datf) (write-line ".layer ON * " datf) (while (> strno 0) (progn (write-line (strcat ".layer freeze " (eval (read (strcat "thaw" (itoa strno)))) " ") datf) (setq strno (1- strno)) );progn );while (while (> strnn 0) (progn (write-line (strcat ".layer off " (eval (read (strcat "on" (itoa strno)))) " ") datf) (setq strnn (1- strnn)) );progn );while (write-line (strcat ".layer freeze " thawl " ") datf) (write-line (strcat ".layer off " onl " ") datf) (close datf) );defun C:SAVEDISP