;**************************************************** ;CKLAY.LSP ;---------------------------------------------------- ; ...revised, improved and editted by Erik Murray 12/05/98 ; ...original author unknown (defun C:CHECK (/ LAY LLIST TEST) ; Write layer list to ACADTEMP folder (defun write_llist () (prompt "\n Writing Layer List to AutoCAD folder....") (setq ;FNAME "d:\\acadtemp\\chk_lay.lst" ;;old way - new way is path independent FNAME (findfile "acad.exe") FNAME (strcat (substr FNAME 1 (- (strlen FNAME) 8)) "chk_lay.lst") FILE (open FNAME "w") LLIST (tblnext "LAYER" T)) (while LLIST (setq LAY (cdr (assoc 2 LLIST))) (if (and (not (wcmatch LAY "*|*")) (/= 1 (logand (cdr (assoc 70 LLIST)) 1))) (progn (write-line LAY FILE) (setq LLIST (tblnext "LAYER")) (prompt ".") ) ;end progn (setq LLIST (tblnext "LAYER")) ) ;end if ) (close FILE) (alert (strcat "Type CHECK to isolate each" "\n layer in the drawing." "\n\nFROZEN layers and XREF" "\nlayers will not be checked.") ) ;end alert (setq FNAME nil FILE nil LAY nil LLIST nil WRITE_CHK_LST T) ) ;end defun write_llist ;Main function (if (not WRITE_CHK_LST) (write_llist) ) ;end if (if (not FNAME) (progn (setq ;FNAME "d:\\acadtemp\\chk_lay.lst" ;;old way - new way is path independent FNAME (findfile "acad.exe") FNAME (strcat (substr FNAME 1 (- (strlen FNAME) 8)) "chk_lay.lst") FILE (open FNAME "r") ) ;end setq ) ;end progn ) ;end if (setq LAY (read-line file)) (princ "\nFiltering out unused layers.") (while (and LAY (if LAY (not (ssget "X" (list (cons 8 LAY)))))) (princ ".") (setq LAY (read-line FILE)) ) ;end while (if (/= LAY nil) (command "layer" "ON" LAY "s" LAY "OFF" "*" "" "") (progn (close FILE) (setq FNAME (strcat "del \"" FNAME "\"")) (command "shell" FNAME) (setq FNAME nil FILE nil WRITE_CHK_LST nil) (alert "\nAll Layers Checked!\n\nNow turning on all layers.") (command "layer" "on" "*" "") ) ;end progn ) (princ) ) ;end defun c:cklay (princ)