home *** CD-ROM | disk | FTP | other *** search
- ;;; --------------------------------------------------------------------------;
- ;;; DELLAYER.LSP
- ;;; Copyright (C) 1990 by Autodesk, Inc.
- ;;;
- ;;; Permission to use, copy, modify, and distribute this software and its
- ;;; documentation for any purpose and without fee is hereby granted.
- ;;;
- ;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
- ;;; ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
- ;;; MERCHANTABILITY ARE HEREBY DISCLAIMED.
- ;;;
- ;;; --------------------------------------------------------------------------;
- ;;; DESCRIPTION
- ;;;
- ;;; This program deletes all entities on specified layers. Wildcards
- ;;; can be specified.
- ;;;
- ;;; --------------------------------------------------------------------------;
-
- (defun dellerr (s) ; If an error (such as CTRL-C) occurs
- ; while this command is active...
- (if (/= s "Function cancelled")
- (princ (strcat "\nError: " s))
- )
- (setq S nil) ; Free selection-set if any
- (setvar "CMDECHO" ocmd) ; Restore saved mode
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
- )
-
- ;;; ------------------------- Main Program -----------------------------------;
-
- (defun C:DELLAYER (/ olderr ocmd L S)
- (setq olderr *error*
- *error* dellerr)
- (setq ocmd (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (setq L (strcase (getstring "\nLayer(s) to delete: ")))
- ;; Get all entities on layer(s)
- (setq S (ssget "X" (list (cons 8 L))))
- (if S
- (command "ERASE" S "") ; Delete 'em!
- (princ "Layer empty or not a valid layer name.")
- )
- (setq S nil) ; Free selection-set
- (setvar "CMDECHO" ocmd) ; Restore saved mode
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
- )
-
- ;;; --------------------------------------------------------------------------;
-
-
-