; LAYINFO - Writes all global layer information out to a comma ; deliniated sorted file - named . ; Information Includes: ; Drawing Name ; Current Layer Name ; Layer Name ; ON/OFF Status ; Frozen/Thaw Status ; Color Number ; Linetype ; ; Written by : M. Kiker 73423,1707 ; Date: 4/10/95 ; ; USE AT YOUR OWN RISK... ; (defun catcherr (s) (if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs (princ (strcat "\nError: " s)) ; while this command is active... ) (setq p nil) ; Free selection set (setq *error* olderr) ; Restore old *error* handler (princ) ) (defun C:LAYINFO (/ fil layinfo stri dwgnam lname thw thwstr colr colrnum ltype colrstr) (setq olderr *error* *error* catcherr) (prompt "\nGenerating Layer File...") (setq fil (open (strcat (getvar "dwgname") ".TXT") "w")) ; (write-line (strcat "Layers for: " (getvar "dwgname") ".DWG" ) fil) (write-line " " fil) (write-line (strcat "Current Layer: " (getvar "clayer")) fil) (write-line " " fil) ; (setq lay (tblnext "layer" T) lay_list nil) (while lay (setq lay_list (append lay_list (list (cdr (assoc 2 lay)))) lay (tblnext "layer")) ) (setq lay_list (acad_strlsort lay_list)) (foreach lay lay_list (setq layinfo (tblsearch "layer" (strcase lay))) (setq lname (cdr (assoc '2 layinfo))) (setq thw (rtos (cdr (assoc '70 layinfo)) 2 0)) (setq colr (cdr (assoc '62 layinfo))) (setq colrnum (rtos (abs colr) 2 0)) (setq ltype (cdr (assoc '6 layinfo))) (if (or (= thw "65") (= thw "67") (= thw "69") (= thw "97") (= thw "99") (= thw "101") (= thw "113") (= thw "115") (= thw "117") ) (setq thwstr "FR") (setq thwstr "TH") ) (if (< colr 0) (setq colrstr "OF") (setq colrstr "ON") ) (setq stri (strcat lname "," colrstr "," thwstr "," colrnum "," ltype )) (write-line stri fil) ) (close fil) (setq prefix (getvar "dwgprefix")) (setq name1 (getvar "dwgname")) (setq prelen (strlen prefix)) (setq stl (strlen name1)) (setq name (substr name1 (+ 1 prelen) stl)) (setq name (strcat name ".TXT")) (setq name (strcase name)) (prompt (strcat "\nFile " name " created.")) (princ) )