本帖最后由 llsheng_73 于 2023-5-15 22:04 编辑
- (defun c:TT(/ *blocks *layers *Model lys atts co)
- (vl-load-com)
- (if(setq *doc(vlax-get-property (vlax-get-acad-object)'ActiveDocument)
- *Model(vlax-get-property *doc'ModelSpace)*blocks(vlax-get-property *doc 'blocks)
- *layers(vlax-get-property *doc 'layers)
- co(acad_colordlg 1 nil))
- (progn
- (vlax-for blk *blocks(or(vl-position(vlax-get-property blk 'name)'("*MODEL_SPACE""*PAPER_SPACE"))(vlax-for x blk(vlax-put-property x'color 0))))
- (vlax-for x *layers
- (setq lys(cons(entget(vlax-vla-object->ename x))lys))
- (vlax-put-property x 'lock 0))
- (vlax-for x *Model
- (VL-CATCH-ALL-APPLY'vlax-put-property(list x'color co))
- (or(VL-CATCH-ALL-ERROR-P(setq n 0 atts(VL-CATCH-ALL-APPLY 'vlax-invoke-method(list x'GetAttributes))))
- (VL-CATCH-ALL-ERROR-P(setq atts(VL-CATCH-ALL-APPLY 'vlax-safearray->list(list(vlax-variant-value atts)))))
- (foreach x atts(vlax-put-property x'color co))))
- (vl-every'entmod lys))))
;;更改所有图元颜色为指定颜色,临时解锁(图层雾化不影响)所有图层,完事恢复所有图层 |