马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Lisphk 于 2017-5-28 21:03 编辑
1、AUTOLISP ENTMOD方法:
 - (defun c:tt ()
- (if (and (setq clr (getint "\n输入颜色号<退出>:"))
- (setq e (car (entsel)))
- (setq ent (entget e))
- )
- (entmod (append ent (list (cons 62 clr))))
- )
- (princ)
- )
2、VLA方法:
 - (defun c:tt ()
- (if (and (setq clr (getint "\n输入颜色号<退出>:"))
- (setq e (car (entsel)))
- (setq col (vlax-create-object
- (strcat "AutoCAD.AcCmColor."
- (substr (getvar "acadver") 1 2)
- )
- )
- )
- )
- (progn
- (vla-put-colorindex col clr)
- (vla-put-TrueColor (vlax-ename->vla-object e) col)
- (vlax-release-object col)
- )
- )
- (princ)
- )
或者更直接些,用 vla-put-color
 - (defun c:tt ()
- (if (and (setq clr (getint "\n输入颜色号<退出>:"))
- (setq e (car (entsel)))
- )
- (progn
- (vla-put-color (vlax-ename->vla-object e) clr)
- )
- )
- (princ)
- )
3、批量的对话框选色修改
 - (defun c:tt ( / col idx sel )
- (if
- (and
- (setq sel (ssget "_:L"))
- (setq col (acad_truecolordlg 1))
- )
- (repeat (setq idx (sslength sel))
- (entmod (append (entget (ssname sel (setq idx (1- idx)))) col))
- )
- )
- (princ)
- )
|