求助:删除图层的问题
我现在的图中有好多图层,分别是数字命名的,如:1002 ,1003,2001如何用lisp写一段程序删除,以1,或者2开头的图层那??
谢谢 存在对象的图层是不能直接用purge删除的.请试试以下程序:
(defun c:dellay(/ laye dellay_obj dellay_obj_len ans)<BR> (setvar "cmdecho" 0)<BR> (command "._layer" "t" 0 "on" 0 "u" 0 ""<BR> "._clayer" 0)<BR> (setq laye (getstring "\n请输入需删除的层码:"))<BR> (if (= (tblsearch "layer" laye) nil) (progn (princ (strcat "\n本文件不存在 <" laye "> 层,请确认!")) (exit)))<BR> (command "._layer" "t" laye "u" laye "")<BR> (setq dellay_obj (ssget "x" (list (cons 8 laye))))<BR> (if (/= dellay_obj nil)<BR> (progn<BR> (setq dellay_obj_len (sslength dellay_obj))<BR> (princ (strcat "\n <" laye "> 层存在" (itoa dellay_obj_len) "个对象!"))<BR> (initget "Yes No")<BR> (setq ans (getkword "继续Yes / 取消No <N>:"))<BR> (if (null ans) (setq ans "No"))<BR> (if (= ans "No") (exit))<BR> (command "._erase" "p" ""<BR> "._purge" "la" laye "n"))<BR> (command "._purge" "la" laye "n")<BR> )<BR> (prompt (strcat "\n <" laye "> 层已删除!"))<BR> (prompt "\n程序版次: V1.0 开发人员:wjm3 完成日期:2004年03月01日")<BR> (prin1)<BR> ) ;;;end file (defun c:test( / lay name)<BR> (setq lay nil)<BR> (setvar "cmdecho" 0)<BR> (while (setq lay (tblnext "layer" (not lay)))<BR> (setq name (cdr (assoc 2 lay)))<BR> (if (or (= (substr name 1 1) "1") (= (substr name 1 1) "2"))<BR> (command "_.PURGE" "la" name "n")<BR> )<BR> )<BR> (princ)<BR>) 如果删除的层不是很多,命令行直接输入这个也可以
(command "erase" (ssget "x" '((8 . "1003"))) "") crane_QS发表于2004-4-6 16:40:00static/image/common/back.gif如果删除的层不是很多,命令行直接输入这个也可以
(command \"erase\" (ssget \"x\" '((8 . \"1003\"))) \"\")
<BR>这样能删除图层???你用的是什么系统?我从R12用到了2005,还从来没有发现这样也可以 谢谢了
No unreferenced layers found.
怎么包这个啊,好像图层也没有删除调那? 图 哦,你是想光删图层啊?!
我以为是删除图层里的图了,呵呵~误会了 我想楼主既然想删掉这些层,肯定这些层里已经没有东西了,而且如楼上的,要一个一个地输入层名,那还要程序做什么?LAYER命令已经相当方便了
页:
[1]