(defun SSGETLTYPE (LT / LAYER LLIST FILTER AWS AWS2) (if(=(type LT)'STR) (progn (While (setq LAYER (tblnext "LAYER" (null LAYER))) (if(=(strcase(cdr(assoc 6 LAYER)))(strcase LT)) (setq LLIST(cons (cdr(assoc 2 LAYER)) LLIST)) ) ) (setq FILTER (append '((-4 . "")) ) ) (setq AWS (ssget "_x" FILTER)) (setq AWS2 (ssadd)) (setq INDEX -1) (repeat (sslength AWS) (if(or(not(assoc 6(entget(setq OBJ(ssname AWS(setq INDEX(1+ INDEX))))))) (=(strcase(cdr(assoc 6 (entget OBJ))))(strcase LT)) ) (ssadd OBJ AWS2) ) ) (sssetfirst AWS2 AWS2) ) ) )