;| LAYLIST.LSP (c) 1998 Tee Square Graphics Creates an alphabetized list of all layers in a the current drawing, and writes the list to file LAYERS.TXT. LAYERS.TXT may be edited and/or printed with any ASCII text editor (i.e., NotePad). |; (defun C:LAYLIST (/ ent outf len lst lyr clr ltp hdr sep status) (setq ent (tblnext "layer" T) outf (open "layers.txt" "w") len 0) (while ent (setq lyr (cdr (assoc 2 ent)) len (max (strlen lyr) len) ent (tblnext "layer") lst (append (list lyr) lst))) (setq hdr " Layer" sep " -----") (repeat (- len 6) (setq hdr (strcat hdr " ") sep (strcat sep " "))) (write-line (strcat hdr "\tColor\t LineType\tStatus") outf) (write-line (strcat sep "\t-----\t --------\t------") outf) (foreach lyr (acad_strlsort lst) (setq ent lyr dif (- len (strlen lyr))) (repeat dif (setq lyr (strcat lyr " "))) (setq ent (tblsearch "layer" ent) clr (cdr (assoc 62 ent)) ltp (cdr (assoc 6 ent)) status "" stat (cdr (assoc 70 ent))) (if (minusp clr) (setq status "Off")) (if (= (logand stat 1) 1) (setq status (strcat status (if (> status "") ", Frozen" "Frozen")))) (if (= (logand stat 4) 4) (setq status (strcat status (if (> status "") ", Locked" "Locked")))) (write-line (strcat lyr "\t " (itoa clr) "\t" ltp "\t" status) outf)) (close outf) (alert "See LAYERS.TXT for list of layers.") (princ) ) (alert (strcat "LAYLIST.LSP (c) 1998 Tee Square Graphics\n\n" " Type LAYLIST to begin..."))