(defun dele (ss / slen n s1 s sn ed )
	(setq slen (sslength ss)
		n 0)
	(while (/= n slen)
		(setq	s1 (ssname ss n)
			 s (entget s1)
			sn (cdr (assoc 0 s)))
		(if (or (= sn "DIMENSION") 
			(and (= sn "TEXT") (/= (cdr (assoc 62 s)) 140) (and (/= (cdr (assoc 1 s)) "DATUM") (/= (cdr (assoc 1 s)) "datum")))
			(= sn "SOLID")
			(and (= sn "POLYLINE") (> (cdr (assoc 40 s)) 0))
			(and (= sn "LINE") (= (cdr (assoc 6 s)) "CENTER") (/= (cdr (assoc 62 s)) 2))
			(= sn "ATTDEF"))
			(COMMAND "ERASE" S1 ""))
		(if (= (assoc 6 s) NIL)
		    (progn 
		    	(setq ed (CONS (cons 6 "CONTINUOUS") s))
			(entmod ed)
			(entupd s1)))
		(if (= (assoc 62 s) NIL)
		    (progn 
		    	(setq ed (CONS (cons 62 7) s))
			(entmod ed)
			(entupd s1)))
		(setq n (1+ n))
 	)
	(redraw)
)
(defun c:de (/ asks co clayer olderr)
	(setvar "blipmode" 0) (command "_.UNDO" "_GROUP")
	(setvar "cmdecho" 0) 
 	(setq	olderr *error*
	     *error* ai_abort
		asks (getstring "\nAll layer / <clayer>: "))
	(if (/= asks "") (setq ss (ssget "x"))
  		(setq clay (getvar "clayer")
	              ss (ssget "x" (list (cons 8 clay))))
	)
 	(dele ss)
	(setq *error* olderr) (command "_.UNDO" "_E")
        (princ)
)