本帖最后由 newer 于 2025-2-15 20:45 编辑
 - (defun c:tt ()
- ;用ACAD命令chprop修改颜色
- (setvar "cmdecho" 0)
- (while (and (setq e (car (entsel "\n拾取要修改的对象<退出>:")))
- (setq clr (getint "\n输入颜色号<退出>:"))
- )
- (command ".chprop" e "" "color" clr "")
- )
- (princ)
- )
 - (defun c:tt ()
- ;用修改实体数据修改颜色,颜色祖码是 62
- (setvar "cmdecho" 0)
- (while (and (setq e (car (entsel "\n拾取要修改的对象<退出>:")))
- (setq clr (getint "\n输入颜色号<退出>:"))
- )
- (setq ed (entget e)
- old (assoc 62 ed)
- new (cons 62 clr)
- )
- (if old
- (setq ed (subst new old ed))
- (setq ed (cons new ed))
- )
- (entmod ed)
- )
- (princ)
- )
 - (defun c:tt ()
- ;用XDRX API
- (xdrx-begin)
- (while (and (setq e (car (xdrx-entsel "\n拾取要修改的对象<退出>:")))
- (setq clr (getint "\n输入颜色号<退出>:"))
- )
- (xdrx-setpropertyvalue e "color" clr)
- )
- (xdrx-end)
- (princ)
- )
 - (defun c:tt ()
- ;用vlax activex com
- (while (and (setq e (car (entsel "\n拾取要修改的对象<退出>:")))
- (setq clr (getint "\n输入颜色号<退出>:"))
- )
- (setq obj (vlax-ename->vla-object e))
- (vla-put-color obj clr)
- )
- (princ)
- )
|