muck Posted May 10, 2009 Share Posted May 10, 2009 Using AutoCAD VBA, Is it possable to access a text string in a block? I want to get a block textstring to change color or layer? Note, I am not taking about a block attribute. I am trying to access a string of text that is in the block. I am interested in acessing both the block definations and block references. I am also interested in accessing Mtext and dimensions in a block. Thank you, Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 11, 2009 Share Posted May 11, 2009 Here is a change linetype example shopuld be able to change the code to search for text and then change. You can call lisp from VBA ;(defun c:normblocks (/ adoc) (vl-load-com) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark adoc) (vlax-for block (vla-get-blocks adoc) (if (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) (vlax-for ent block (if (= (vla-get-linetype ent ) "solid" ) (progn (vla-put-linetype ent "Continuous") (princ (vla-get-name block)) ) );_ end of if ) ;_ end of vlax-for ) ;_ end of if ) ;_ end of vlax-for (vla-regen adoc acactiveviewport) (vla-endundomark adoc) (princ) try replacing (if (= (vla-get-linetype ent ) "solid" ) with (if (=(vla-get-text ent ) mytext ) not sure if ok this code was done by but met my needs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.