automatically change text size using Text Style

automatically change text size using Text Style

Anonymous
Not applicable
7,807 Views
8 Replies
Message 1 of 9

automatically change text size using Text Style

Anonymous
Not applicable

Hi. I created several text objects using MTEXT on a particular layer and assigning them a text style called "normal". The text hight is 10. But when I change the text hight on "normal" to 5 the text objects dont change automatically. They remain in the same size. So I have to select them all, go to properties pallete and change the text hight (or change the style to any other and go back to "normal". That would do it too). I dont know if this is the way it's supossed to be. So my question is, am I doing something wrong? What is the more efficient way to change automatically the hight for all the text objects? Is there a rutine to achieve that?

0 Likes
Accepted solutions (2)
7,808 Views
8 Replies
Replies (8)
Message 2 of 9

imadHabash
Mentor
Mentor

Welcome to our community,

 

it will be great if you attche your file with only few mtext words to help you and give you the right answer.

 

 

Imad Habash

EESignature

0 Likes
Message 3 of 9

pendean
Community Legend
Community Legend
TEXTSIZE is a separate variable.
STYLE command settings also have no effect on MTEXT text sizes or text set to a different height manually with that variable or within "text" commands.


0 Likes
Message 4 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

.... I created several text objects ... assigning them a text style called "normal". The text hight is 10. But when I change the text hight on "normal" to 5 the text objects dont change automatically. ... I have to select them all, go to properties pallete and change the text hight (or change the style to any other and go back to "normal". ... am I doing something wrong? What is the more efficient way to change automatically the hight for all the text objects? Is there a rutine to achieve that?


You're not doing anything wrong, as far as I know -- it's worked that way as long as I can remember.  I suspect that the height of a Text/Mtext object is given to it from the Style's defined height if it has one, when the Text/Mtext is created, and it is then just part of its entity data, the same as the height for Text/Mtext that is of a Style without a fixed height.  The entity data certainly don't make any distinction -- there's a height entry for all such objects, regardless of Style.  If it were completely dependent on the Style's defined height and would update automatically when that was changed, then there would be no need for a height entry in the entity data for such objects.  Only an explicit height override, or transfer to a different Style [forcing it to look at whether that has a fixed height], will change it.

 

A routine could certainly be written that would step through every Text/Mtext object [either in the drawing or among a User selection], check whether its Style has a defined height, and if so, impose that on the object.  It should not be difficult -- I can't do it right now, but will give it a shot later if no one else beats me to it.

Kent Cooper, AIA
Message 5 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

... Is there a rutine to achieve that?


Now there is [in comparatively basic form, and lightly tested], to validate the anticipatory Accepted-Solution designation:

 

;;  TextHeightUpdate.lsp [command name: THU]
;;  To Update the Height of Text and Mtext in Styles with defined heights,
;;    when height has been changed in Style definition.  Checks Style of all
;;    selected Text/Mtext, and it has a defined height, imposes that on object.
;;  Kent Cooper, 23 February 2015
(defun C:THU (/ ss n obj ht)
  (prompt "\nTo Update the Height of fixed-height Text/Mtext,")
  (if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
    (repeat (setq n (sslength ss))
      (setq obj (vlax-ename->vla-object (ssname ss (setq n (1- n)))))
      (if
        (> (setq ht (cdr (assoc 40 (tblsearch "style" (vla-get-StyleName obj))))) 0)
        (vla-put-Height obj ht); then
      ); if
    ); repeat
  ); if
  (princ)
); defun
(vl-load-com)
(prompt "\nType THU for Text Height Update.")

Kent Cooper, AIA
0 Likes
Message 6 of 9

scot-65
Advisor
Advisor

It has been my experience when a MTEXT object does not have an override text height and/or override text width assigned to it, then changing properties in the STYLE command would affect these objects. If not mistaken, this condition exists when the text style used for MTEXT objects has an assigned height greater than zero (which means TEXTSIZE has no bearing on these objects).

 

Need to verify.

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 7 of 9

Anonymous
Not applicable

I know this is an old thread, but I've found the lisp routine very helpful.  Would there be an easy way of adding the functionality of updating the width factor and obliquing angle to match the text style at the same time?  Right now it only affects heights.  Thanks!

0 Likes
Message 8 of 9

Kent1Cooper
Consultant
Consultant

That could probably be done similarly, but here's what I do, which I believe covers all variable characteristics in Style definitions [so it can also be used in place of the code earlier in this thread]:

 

Select all the Text/Mtext objects you want to update to the Style's revised definition [whether by on-screen selection, QSELECT, FILTER, or whatever].

 

In the Properties box, Style slot, pick any other Style, and then just pick the original Style again.

Kent Cooper, AIA
Message 9 of 9

Anonymous
Not applicable

Thank you Kent, until I learn how to do my own lisp programming, that solution works great.  Thanks!

0 Likes