|
Pearls from the auld Scotsman
Few people know Visio software and communicate their knowledge as well as
Dave Edson. In this regular column Dave dispenses pearls of wisdom in his own inimitable
style.
|
Auto-Scaling
Fonts in Visio
Adam
Stone
Fonts that scale based on the height of the
object and the scale of the drawing
Back in the early
days of my Visio experimentation I realized that that the most efficient way to create my
solution was to have Visio master shapes based on data stored in outside tables. This way
one master shape could represent an unlimited number of items. At that time most Visio
solutions used a single master shape for each item that the user wanted to represent. This
meant a lot more custom drawing of shapes. And since my graphic skills are on par with my
writing skills I wanted to automate the process as much as possible.
The requirements for my solution called for
the shapes to automatically assign the proper manufacturer and model to each shape as it
was dropped on the drawing and to appear correct at standard 1/8" to 1" =
1 architectural scales. Also since the size of the objects that I was using would
vary I needed to have these labels scale based on the height of the shape as well.
Heres how to do it:
- Start out with a standard Visio box drawn about
19" W X 12" H at a 1" to 1 scale. Use the Visio Text Tool to draw a
text box in the upper third of the box and call that "Manufacturer" Do the same
with the lower third but call that one "Model".
- Group all three shapes, in this case the group shape
ID is 73.
- Click on the manufacturer text block so a gray
outline can be seen and open the ShapeSheet. Insert two rows of user defined cells, name
one User.Fontsize and the other User.AntiScale.
- In the User.Fontsize value field type in the
following forumla...
MIN(12
pt.,MAX(1 pt.,Sheet.73!Height/4.5/User.AntiScale))
- In the User.AntiScale value field type
in...
ThePage!DrawingScale/ThePage!PageScale
- To complete this exercise go to the Character
section of the shape sheet and in the area type in User.Fontsize in the Size
field.
Your shape with scalable fonts is done, time to play with it. Adjust
the height of the shape and watch the manufacturer label automatically scale relative to
the size of shape 73, See how the model label doesnt change. Since User.Fontsize
formula has and MIN and MAX function the font will always stay between 1 and 12 points.
Now change the scale on the drawing to ¼" = 1, notice how the manufacturer
label still looks right but the model is way out of proportion.
The mechanics of the formula are pretty simple. The
character size is tied to the User.Fontsize which uses a formula that basically says the
height of the master shape divided by a number that I use to control the font size divided
by the Antiscale formula. The Antiscale formula is also controls the size of the font
based on the scale of the drawing page. You can experiment with these formulas to get the
font sizing just the way you want.
This is a powerful tool to use when you want to
automate the drawing process because now a single master shape can work with all sizes and
common scales.
Adam Stone
|
|