(defun c:lo() (setvar "cmdecho" 0) (setq sels (ssget) ) (if sels (lomain) ) (princ) )
(defun lomain() (setq n (sslength sels) ) (setq llist '() ) (repeat n (setq a (ssname sels (setq n (1- n))) ) (setq b (cdr (assoc 8 (entget a))) ) (if (member b llist) () (setq llist (cons b llist) ) ) ) ) (if (member (getvar "clayer") llist) () (setvar "clayer" (setq lay (last llist))) )
(command "layer" "off" "*" "y") (foreach x llist (command "on" x)) (command "") ) |