< ><FONT face=宋体>经常插了一些颜色很乱的图,打出来很难看.
现改到块所在的层.</FONT></P>
<P><FONT face=宋体>;;;By Aeo
(defun c:tk( / blk blkref blocks doc ent name )
(vl-load-com)
(if(and (setq BLK (car (entsel "\n选要随层的块: ")))
(setq BLKREF (vlax-ename->vla-object BLK))
(not(and(/= (vla-get-objectname BLKREF) "AcDbBlockReference")
(princ"\n不是块:"))
)
(setq name(vla-get-name BLKREF))
)
(progn
(command"undo""group")
(setq DOC (vla-get-activedocument (vlax-get-acad-object))
BLOCKS (vla-get-blocks doc)
blk (vla-item BLOCKS name)
)
(vlax-for ENT blk
(vla-put-layer ent "0")
(vla-put-color ent 256)
)
(vla-regen doc acActiveViewport)
(vlax-release-object blk)
(vlax-release-object BLOCKS)
(vlax-release-object DOC)
(command"undo""end")
(princ"\nUndo后请regen.")
)
)
(princ))
</FONT></P> |