 ; Lake - selectively erase entities on a selected layer.
 ; Copyright 2005 by Rocket Software Ltd.
 ; Wet Otter - this summer's surprise hit fragrance.
 (DEFUN C:LAKE (/ *error* prom enampt enam ss)
  (setvar "cmdecho" 0)
  (command "undo" "be")
  (setq snapp (getvar "snapmode"))
  (setvar "snapmode" 0)
  (defun *error* (shk /)
   (setvar "snapmode" snapp)
  (princ))
  (if (= (type laya) 'STR)
      (setq prom (strcat "Trash Layer <" laya "> or select entity: "))
      (setq prom "Entity on Trash Layer: "))
  (if (setq enampt (entsel prom))
      (progn
           (setq enam (car enampt))
           (setq laya (cdr (assoc 8 (entget enam))))))
  (if (= (type laya) 'STR)
      (progn
           (princ laya)
           (prompt "\nStuff to erase: ")
           (if (setq ss (ssget (list (cons 8 laya))))
               (command ".erase" ss ""))))
  (setvar "snapmode" snapp)
 (princ))