masterfal Posted March 11, 2020 Posted March 11, 2020 Hi All, I have a command which i can run to select all my text objects and was wondering if anyone knew how i could tweak it so that after it selects all these objects it puts them all in text style "standard"? At the moment i'm selecting all the text and then manually changing to standard. Would be alot better if could combine so automatically puts into "standard" text style. Also does anyone know if could also include text inside blocks? Have had a look around but couldn't find a good routine that works on blocks.. (defun c:at (/ sel1) (setq sel1 (ssget "_x" '((0 . "MTEXT,TEXT,DIMENSION,ATTDEF,LEADER,MULTILEADER")))) (sssetfirst nil sel1) (princ) ) Quote
BIGAL Posted March 11, 2020 Posted March 11, 2020 You will need a defun for each type of object, regarding the block you have to look at each entity then change if its text or mtext. Just start having a go take one type of object at a time say "text" 1st use VL-put-stylename. There is plenty of code examples and given your number of posts you should have a go. When you get stuck ask here. This is a start for a block some code that changes entity you will need a is text mtext. (setq doc (vla-get-activedocument (vlax-get-acad-object))) ; open database (setq allblocks (vla-get-blocks doc)) (vlax-for block allblocks (if (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) (vlax-for ent block (vla-put-color ent 0) (vla-put-linetype ent "Bylayer") (vla-put-lineweight ent aclnwtbyblock) ) ;_ end of vlax-for ) ;_ end of if ) ;_ end of vlax-for Quote
masterfal Posted March 11, 2020 Author Posted March 11, 2020 ignoring the block modificatons which im assuming is bit trickier, can the code i posted have something added at the end which will change everything selected into text style named standard? or are you saying can't do all in one go like that, need to have one set up for mtext, another one for dimensions etc etc? Quote
BIGAL Posted March 11, 2020 Posted March 11, 2020 All done in one go but need to make a method for each type of entity, using cond run a defun to suit. repeat for ssget get a ssname (cond ((is it leader ? do defun1)) ((is it text ?do defun2)) ((is it block ? do defun3)) ........ ) Next Some of the objects can use the same defun others like the block need special code, mtext can have multiple styles in it does that need to be checked ? Text can be just changed (vla-put-stylename obj "Standard") Leader multiline text, have not looked. So use dumpit.lsp to look at what property is to be changed and what the object name is. Quote
tombu Posted March 11, 2020 Posted March 11, 2020 Dialog box lisp - Merge text styles (or change text styles) version 4.2 by T.Willey may be what you're looking for. It works with text, mtext, dimensions, and mleaders. Merge, delete, create any text style including annotation styles. You can even modify them by object type. I've used it for many years. Quote
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.