下面的程序目的找出图层内所有含EC*为开头的图层,并将所有以EC为开头的图层按日期先后将其本来颜色改成41#~50#颜色(如将EC20091003换成41#色,EC20090929换成42#色),也有些图层可能是年份2009省略为09,比较麻烦的事! 遍历完后再依据当前时间新建图层 简言之,程序想要的结果是,避免新日期图层与老日期图层的颜色重叠! 在写下面的程序,想要遍历图层表,发现tblsearch "layer" "ec*" 返回的值是nil,该如何写这段代码,求教! (defun c:ECN () (setvar "CMDECHO" 0) (if (setq ss (ssget "X" '((8 . "EC*")))) ;;;此段代码有误,应将查找物体改为遍历图层 (command ".chprop" ss "" "C" "61" "") ) (setq date1 (rtos (getvar "cdate")2 0)) (setq ecn (strcat "EC" date1)) (if (not(tblsearch "layer" ecn)) (command "layer" "new" ecn "set" ecn "c" "5" ecn "") (command "layer" "set" ecn "") ) (setvar "CMDECHO" 1) (princ) )
|