Corro Posted September 19, 2016 Share Posted September 19, 2016 Good Morning All I have been try to write a lisp routine to convert old text styles to the new text style within inserted blocks. This a part of a larger routine to clean up old drawings. I am trying to select the blocks within the drawing and ten get it to select only text or mtext, but I am receiving every object within the drawing. What am I going wrong????? Attached is lisp routine and simple sample drawing. Using AutoCAD 2017. Thank you for any help. Steve 000 test 12.lsp X_STRCT1.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 19, 2016 Share Posted September 19, 2016 (edited) A better approach would be to redefine the individual block in the block table ie at the top of the tree and then just update the drawing, rather than get all blocks. which ssget "insert" is doing. Something like this but look at the entity and check for text or mtext and change style. I would get the entity name and run a series of conds, as text & mtext are pretty staright forward but attributes styles are a level lower again but you can check the "Hasattributes" variable and then search deeper. You can use dumpit.lsp to get a list of the variable names of an object, then you go further using (vlax-dump-object variable) (setq allblocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (vlax-for block allblocks (setq blkname (vla-get-name block)) (if (not (wcmatch (strcase blkname t) "*_space*")) (vlax-for ent block (If (= "AcDbText" (vla-get-objectname ent)) (vla-put-StyleName ent "arial") ; need a vla-put-textstyle here ) ; if ) ;_ end of vlax-for ) ;_ end of if ) ;_ end of vlax-for (Command "regen") (princ) (if (= (vla-get-hasattributes ent) -1) (foreach att (vlax-invoke ent 'getattributes) ;look at textstyle see if I can find an example Edited September 20, 2016 by BIGAL 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.