下面一段程序能实现改变颜色和层的功能.
(defun c:test () (setq ss (progn (princ "\n选择图元:") (ssget)) ;;;User input,and obtain the user's data;;; layname (getstring "\n输入所要改变到的图层:") color (getint "\n输入改变后的颜色索引号(如1,2,255等):") ) (if (not (tblsearch "layer" layname)) ;;;search if there is the layer of layname through out the drawing, (command "-layer" "n" layname "") ;;;if not,then creat it. ) (command "chprop" ;;;change the property--"layer" and "color". ss "" "la" layname "c" color"" ) ) |