(defun c:slay ( / ) (setq nentsl (nentsel "\nSelect entity on Layer to turn Off. ")) (setq nentla (cdr(assoc 8(entget(car nentsl))))) (if(=(cdr(assoc 0(entget(car nentsl))))"VERTEX") (setq entsp1(cdr(assoc 10(entget(car nentsl)))) entsp2(cdr(assoc 10(entget(entnext(car nentsl))))) snpang(angtos(angle entsp1 entsp2)0 4)) (if(=(cdr(assoc 0(entget(car nentsl))))"LINE") (setq entsp1(cdr(assoc 10(entget(car nentsl)))) entsp2(cdr(assoc 11(entget(car nentsl)))) snpang(angtos(angle entsp1 entsp2)0 4)) );if );if (setvar "snapang" (angtof snpang 0)) (setq count 0) (setq entla nentla) (if(and(not(=(cdr(assoc 0(entget(car nentsl))))"LINE"))(not(=(cdr(assoc 0(entget(car nentsl))))"VERTEX"))) nil (while (and(< count (strlen nentla))(not(=(substr entla 1 1)"|"))) (setq entla (substr entla 2)) );while );if (if (= count (strlen nentla)) (setvar "clayer" nentla) (command ".layer" "m" (substr entla 2) "c" (substr entla 8 1) "") );if (command) (command ".layer" "off" nentla "") )