Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: goltoof on February 10, 2011, 04:21:49 PM

Title: Displaying shape dimensions automatically
Post by: goltoof on February 10, 2011, 04:21:49 PM
Hope this is the right room :P

I have a number of boxes of different lengths to represent.  Instead of making an individual shape for each box, I'd like to just resize one box and have it show the dimensions right next to the box.  How do I make a shape show how many inches tall/wide it is, in the same way the server rack shape shows the U sizes?

In addition, I'm working with a given number of box lengths with no specific pattern (12, 14, 18, 24, 27 etc) so I don't want it to resize incrementally 12", 13", 14", 15" etc. How do I make the shape size "jump" to preset size lengths?

There should also be a limit to the width/length of the shapes that can't be exceeded.

There should also be an option to right click and be able to "hide dimensions" just how the server rack shape can "Hide U Sizes".
Title: Re: Displaying shape dimensions automatically
Post by: Nikolay on February 10, 2011, 05:12:21 PM
Hi goltoof,

1. Showing dimensions - you could use text field, and set field text to the width of the shape.
2. Limiting length to a specific pattern - you could use BOUND() function to accomplish this.
3. Making "Show dimensions" optional - you could use action cell + visibility (GeometryN.NoShow, HideText cells)

I believe this is enough keywords to start with :)
See the examples below (Visio 2010, take a look at the shape sheets)
Title: Re: Displaying shape dimensions automatically
Post by: wapperdude on February 10, 2011, 05:18:24 PM
Info on the bound fcn may be found here:  http://msdn.microsoft.com/en-us/library/aa431851(v=office.12).aspx
or in the SDK if you've downloaded it.

Wapperdude
Title: Re: Displaying shape dimensions automatically
Post by: goltoof on February 11, 2011, 09:37:47 PM
Quote from: Nikolay on February 10, 2011, 05:12:21 PM
See the examples below (Visio 2010, take a look at the shape sheets)

Hi Nikolay, your example pretty much hits the nail on the head. A few questions..

How do I remove, or change a text field once I've added it to a shape?  I can't select the text field inside the shape once it's created, or find any options to change it's properties.  I even tried removing it from the shapesheet itself, but there's no option to delete the cell, and removing the value just sets the field to "0".

I see how to insert text fields, but I'm not quite getting how you made it appear outside of the shape with the arrows on the perimeter. The text field only shows up in the middle of the box. I tried creating a line shape with a text field and grouping it to the box shape, but the text field shape doesn't move along with the box the way yours does. Could I get a step by step?

How can the bound function make the shape skip specified sizes?  It needs to jump from 6" to 12" while skipping 7-11.  I did not see this in your example.

I also have another shape resting on top of that shape, that I also need to change depending on the height of the box, and a couple other shapes that need to stay put, but I can tackle that later.
Title: Re: Displaying shape dimensions automatically
Post by: wapperdude on February 12, 2011, 02:51:46 AM
To delete the text, there are two options:
1.)  with the shape selected, the text tool should highlight the text, just type over it or hit delete.
2.)  open the shapesheet, scroll down to the Text Field section.  Replace the entry in the value cell with double quotes -- "".

Did you explore the link I posted?  Find the Bound Function entry.  It actually shows example of what you want to do.

Nikolay's shape is a grouped shape.  If you open the Drawing Explorer window (Menu Bar > View > Drawing Explorer), go to Foreground pages, and keep traversing down the tree.  Click on each shape listed and you'll see it highlight in the drawing window.  Shape "sheet.4" has the displayed text.  Open shapesheet, you will see that Text Field entry points back to main shape, sheet.1.

To move your text outside of the shape, select the "Text Block Tool", then, with the shape selected, drag the text to where you want it.  You may have to adjust the text alignment.  (Text Block Tool is option to the Text Tool on menu bar.)

You may want to check out these links for more text info:
http://www.visguy.com/2009/05/06/top-twelve-text-tips/

http://www.visguy.com/2007/11/07/text-to-the-bottom-of-the-shape/

and, of course, this

http://msdn.microsoft.com/en-us/library/aa200986(v=office.10).aspx

Enjoy!!!

Wapperdude.
Title: Re: Displaying shape dimensions automatically
Post by: Nikolay on February 12, 2011, 06:07:06 AM
Quote from: goltoof on February 11, 2011, 09:37:47 PM
How do I remove, or change a text field once I've added it to a shape?  I can't select the text field inside the shape once it's created, or find any options to change it's properties.  I even tried removing it from the shapesheet itself, but there's no option to delete the cell, and removing the value just sets the field to "0".

I think that warpperdude explained this already.
My 5 cents here are that to change "dimensions" field in this sample shape you should change the field not of the "box" shape but of the "dimensions line" shape (which is a sub-shape).

Quote from: goltoof on February 11, 2011, 09:37:47 PM
I see how to insert text fields, but I'm not quite getting how you made it appear outside of the shape with the arrows on the perimeter. The text field only shows up in the middle of the box. I tried creating a line shape with a text field and grouping it to the box shape, but the text field shape doesn't move along with the box the way yours does. Could I get a step by step?

The "trick" was also pretty much explained by wapperdude.
The key point is that "dimension line" shapes refers to parent shape sizes using a custom formula (see the picture). I have done this by editing the shape-sheet formulas directly. Not sure if this can be done using the mouse only. Keep in mind that child shape coordinates are relative to the parent.

Quote from: goltoof on February 11, 2011, 09:37:47 PM
How can the bound function make the shape skip specified sizes?  
It needs to jump from 6" to 12" while skipping 7-11.  I did not see this in your example.

In this example, the box sizes in horizontal direction change by 1cm steps only, and the only allowed widths are: 5,6,7,8,9 cm, all "intermediate" sizes (like 8.5 cm) are skipped. This was implemented using the BOUNDS shape sheet function. Please check the info about the BOUNDS function wapperdude posted.

Width = BOUND(90 mm,0,FALSE,50 mm,50 mm,FALSE,60 mm,60 mm,FALSE,70 mm,70 mm,FALSE,80 mm,80 mm,FALSE,90 mm,90 mm)

Quote from: goltoof on February 11, 2011, 09:37:47 PM
I also have another shape resting on top of that shape, that I also need to change depending on the height of the box,
and a couple other shapes that need to stay put, but I can tackle that later.

Okay  :)
Title: Re: Displaying shape dimensions automatically
Post by: wapperdude on February 13, 2011, 11:09:14 PM
Just out of curiousity, is there a reason not to use the dimensioning shapes?  These attach to the shape in question and provide a lot of capability:  changing the precision, changing the units, hiding the units, line and line-end formatting, moving the text.  Doesn't require using Insert > Fields.

If you want, you can group it with the main shape.

Wapperdude