Ocron Posted February 24, 2011 Posted February 24, 2011 Hello everyone, I've been trying to write a lisp routine to go through and grab all text of a specific layer and then change the Text style of that selection to a different text style. The problem I'm having is that I set-up all my text to be annotative so I need it to correctly change to the annotative scale. When I use the change command in lisp to change the textstyle it changes it to the correct style but does not regenerate (even with using regen) so the text turns into a VERY small text. If I change the text style by the drop down menu to something else and then back to the one I desire it puts it to the correct scale (can't do this for over 100 text that I have to change:( ). Is there a lisp command to change the text style without using the command "change"? I'm not sure if this is the problem or it's just ACAD being ACAD. lol Quote
alanjt Posted February 24, 2011 Posted February 24, 2011 After you change the stylename, you'll have to manually fix the size to be based on the newly chosen textstyle properties. Quote
Tharwat Posted February 24, 2011 Posted February 24, 2011 (edited) Actually it is better to use the "sssetfirst" function for this situation and Ctr+1 to adjust the text height of all the section set. (sssetfirst nil (ssget "_x" '((0 . "TEXT,MTEXT")(7 . "Annotative")(8 . "[color=red][b]LAYERNAME[/b][/color]")))) Tharwat Edited February 24, 2011 by Tharwat Codes modified for better situations Quote
alanjt Posted February 24, 2011 Posted February 24, 2011 I'd avoid entmod'ing annotative objects when possible. Things have a way of going crazy in some releases. Plus, what you are doing is not different than his usage of CHANGE. Quote
Tharwat Posted February 24, 2011 Posted February 24, 2011 Yeah ..... the main bad issue for the Annotative texts is the text height of it. Quote
alanjt Posted February 24, 2011 Posted February 24, 2011 Yeah ..... the main bad issue for the Annotative texts is the text height of it. What?........ Quote
Tharwat Posted February 24, 2011 Posted February 24, 2011 I mean if a drawing has multiple text heights of annotative text style , that's definitely would let texts go crazy when changing heights . Quote
alanjt Posted February 24, 2011 Posted February 24, 2011 I mean if a drawing has multiple text heights of annotative text style , that's definitely would let texts go crazy when changing heights . No, it's a bug with some versions and editing annotative text with entmod. It sets the actual size as the factor, which is then multiplied by the cannoscale variable, which makes the text huge. Quote
Tharwat Posted February 24, 2011 Posted February 24, 2011 OK. So how to step through the Text heights of Annotative text height in a selection set ? Quote
alanjt Posted February 24, 2011 Posted February 24, 2011 OK. So how to step through the Text heights of Annotative text height in a selection set ? Height from text object, actual height for text of specific textstyle from the textstyle data dump, based on annotative scale of text object, do a little math and you have it. Quote
pBe Posted February 25, 2011 Posted February 25, 2011 I'd avoid entmod'ing annotative objects when possible. Things have a way of going crazy in some releases. Plus, what you are doing is not different than his usage of CHANGE. You got that right, thats why i stay away from entmod function when dealing with text (ANY TEXT) Have a look at this: (defun CS (st / a dat) (setq a (ssget '((0 . "TEXT,MTEXT")))) (repeat (sslength a) (setq dat (entget (ssname a 0)) dat (subst (cons 7 st) (assoc 7 dat) dat)) (entmod dat) (ssdel (ssname a 0) a) ) ) When it encounters Annotative MText (Boom) you can avoid that Using VL (defun CS ( st / a) (vl-load-com) (if (setq a (ssget '((0 . "TEXT,MTEXT")))) (mapcar '(lambda (j) (vla-put-stylename (vlax-ename->vla-object j) st)) (vl-remove-if 'listp (mapcar 'cadr (ssnamex a)))) ) (princ) ) USAGE: command: (CS "ROMANS") 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.