2楼
;程序实现,保存为后缀为lsp的文件,加载,运行set_txtcobylayer命令
(defun c:set_txtcobylayer( / ss)
(setq ss (ssget ’ ((0 . "TEXT"))))
(fe-put-ss-color ss 256)
(princ)
)
;|Function: fe-put-color(ename color)
Parameter:
ename: 对象名称
Action:
修改实体颜色
|;
(defun fe-put-color(_sname _color / dxflist)
(setq dxflist (entget _sname))
(if (assoc 62 dxflist)
(setq dxflist (subst (cons 62 _color) (assoc 62 dxflist) dxflist))
(setq dxflist (append dxflist (list (cons 62 _color))))
)
(entmod dxflist)
)
(defun fe-put-ss-color(_ss _color / en i dxflist)
(setq i -1)
(repeat (sslength _ss)
(setq en (ssname _ss (setq i (1+ i))))
(setq dxflist (entget en))
(if (assoc 62 dxflist)
(setq dxflist (subst (cons 62 _color) (assoc 62 dxflist) dxflist))
(setq dxflist (append dxflist (list (cons 62 _color))))
)
(entmod dxflist)
)
)
回复