- UID
- 100033
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-12-4
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
可以此删除多个层上的所有图元,对精简你的DWG文件大有用处。
;;; --------------------------------------------------------------------------;
;;; 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)
)
;;; --------------------------------------------------------------------------; |
|