本帖最后由 vectra 于 2017-9-26 11:44 编辑
增加了对属性的支持
不需要选择颜色时可将(setq c (acad_colordlg 8))这行修改为(setq c 8)
- (defun c:resetcolor (/ c)
- (setq c (acad_colordlg 8))
- (if c
- (vlax-for block (vla-get-blocks
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (vlax-for ent block
- (vl-catch-all-apply 'vla-put-color (list ent c))
- ;; 增加对参照中属性的处理
- (if (and (= "AcDbBlockReference" (vla-get-objectname ent))
- (= :vlax-true (vla-get-hasattributes ent))
- )
- (foreach att (vlax-safearray->list
- (vlax-variant-value (vla-getattributes ent))
- )
- (vla-put-color att c)
- )
- )
- )
- )
- )
- (princ)
- )
|