Lee, fantastic tool, as expected. Thank you for your statement. Already I kept. However, for this, I just want to extract the names of the layers contained in a selection, not the entire design.
(defun c:layernames ( / f l s x ) (if (and (setq s (ssget)) (setq f (getfiled "Create File" "" "txt" 1)) ) (if (setq f (open f "w")) (progn (repeat (setq i (sslength s)) (or (member (setq x (cdr (assoc 8 (entget (ssname s (setq i (1- i))))))) l) (and (write-line x f) (setq l (cons x l)) ) ) ) (close f) ) (princ "\nUnable to open file for writing.") ) ) (princ))
(defun c:layernames ( / f l s x ) (if (and (setq s (ssget)) (setq f (getfiled "Create File" "" "txt" 1)) ) (if (setq f (open f "w")) (progn (repeat (setq i (sslength s)) (or (member (setq x (cdr (assoc 8 (entget (ssname s (setq i (1- i))))))) l) (setq l (cons x l)) ) ) (foreach x (acad_strlsort l) (write-line x f)) (close f) ) (princ "\nUnable to open file for writing.") ) ) (princ))