马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
问题:
I have written a Lisp routine to change the color of all the entities in the
drawing to color green (3). It also iterates through all the block definitions
and changes the color of all subentities to redefine the block. This routine
does not work for blocks which have anonymous blocks as subentities. How can
I change the subentities of anonymous blocks as well?
解决方案:
This problem is easily solved if you use Visual LISP's ActiveX functions. Once
we identify the subentities which are anonymous block references, it is quite
easy to set their subentities' "color" properties. The example below updates
the existing block references in the drawing. Any subsequent insertions of
these blockrefs should not need to be updated.
 - (defun c:SetGreen (/ a_app a_doc a_blks blk ent)
- (vl-load-com)
- (setq a_app (vlax-get-acad-object)
- a_doc (vla-get-ActiveDocument a_app)
- a_blks (vla-get-blocks a_doc)
- )
- (vlax-for blk a_blks
- (if (wcmatch (vla-get-name blk) "*U*")
- (vlax-for ent blk
- (vla-put-color ent acGreen)
- )
- )
- )
- (vlax-release-object a_blks)
- (vla-regen a_doc acAllViewports)
- (princ)
- )
|