Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 919
  • Last Modified:

Adjusting Text height based on Viewport Scale

We are setting our dimension styles with the option "Scale dimension to layout". So whenever the viewport scale is changed a simple "Update" command readjusts the dimension scale to suit the vieport scale.

But for the case of simple text, everytime the viewport scale is changed the new text height or text scale has to be calculated and then applied to selected text.

Is it possible to have a simple command like "Update" which does the calculation as well as modification as in the case of dimension objects?

Saqib Husain, Syed
Saqib Husain, Syed
1 Solution
You can use command SPACETRANS to create a bogus string of text with the purpose of quickly finding the text height needed in Model Space to have the desired Text height in Paper Space:

Convert Text Height Between Model Space and Paper Space
The SPACETRANS command converts distances between model space units and paper space units. By using SPACETRANS transparently, you can provide commands with distance entries relative to another space. For example, you may want to create a text object in model space that matches the height of other text in a layout. From model space, you could enter

Command: text

Specify start point of text or [Justify/Style]: 1,3

Specify height <0.375>: 'spacetrans

>>Specify paper space distance <1.000>: 3/8

Resuming TEXT command

Specify height <0.375>: 1.173

When the command is complete, a text object is created in model space with a height of 1.173, which appears as 3/8 when viewed from a layout.

Then use SCALETEXT using the Model Space height found with SPACETRANS.

Change the Scale of Multiple Text Objects
A drawing may contain hundreds of text objects that need to be scaled, and it would be tedious to scale them individually. Use SCALETEXT to change the scale of one or more text objects such as text, multiline text, and attributes. You can specify a relative scale factor or an absolute text height, or you can scale selected text to match the height of existing text. Each text object is scaled using the same scale factor, and it maintains its current location.

Quick and dirty, if you dont want to resort to macros.
Saqib Husain, SyedEngineerAuthor Commented:
This does not help much. It is an additional step for entering text. Maybe a macro is what I would need.

I shall need some help with respect to event trapping. What events should I trap. I have tried Begincommand and Endcommand but these trappers do not recognise scaling done by scrolling the mouse wheel. How can that event be trapped?

Heh, that why i added "Quick and dirty, if you dont want to resort to macros." ;o)
Probably they could be combined in one customised command, but i'm not skillful with creating those sorry :o(

Its still only 2 commands, SPACETRANS to quicly find the height required to yield the desired height in PS (instead of calculating it yourself), then SCALETEXT to apply it globally.

Good luck
you got this yet?
what version of autocad are you running?
my quick and dirty/lazy way to do this would be to create a qleader with the new scale and then do a mass match properties an all the text. eitherway you do it it seems to me you will have to do some moving around of the text to get it to look right with the new scale.
If you have 2008 I think there is a new "annotative" option that you can assign for different scales.
This could be done fairly easily with Lisp, VBA, etc. It's just a matter of how you want it to function. Will the utility just rip through the entire drawing donig it all? What if the Text is viewable in more than one viewport with different scales? Which does it use? Do you just do one viewport at a time? Select the text you want to do this to?  Where does it resize from? The insert point? Center?

You could also place the text in Paper.

Honestly this isn't worth doing IMO. AutoCAD 2008 allows you to create Annotative text styles that are designed for just this purpose.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now