Tricks for working with the built in Visio shapes

Having shapes that work intelligently is one of the most powerful aspects of Visio. A lot of the built in templates take full advantage of that and react to changes that users make to shape data or by dragging the control handles without requiring code. Most of the time this is exactly what people want to see (you can tell because you don’t even notice this happening). For example, in the Rack Diagram template, the shapes in the stencil snap in to the rack and show the correct “U” size as you resize them manually (similarly, if you type in a “U” size in Shape Data the shape will automatically resize.

This can sometimes be a source of problems, however, when users want to do something to the shape that the designer did not originally consider. In the case of the rack shapes, a customer recently posted to the newsgroups asking how to set up a rack server that was 1.5 U. When you use the shapes, they automatically round the entered value to whole numbers. There are other cases of behaviors where the user has to “fight” Visio to get the behavior or look that they want. The same thing can happen when you use shapes created by third parties.

If you come across this issue, here are a few tips for things to look at to help fix the issue:

  • Select the shape and go to “Format>Protection”. This is a place that shape designers can easily lock things like the shape width, aspect ratio, rotation, and how the shape works with themes. This is usually the first place I check when I am trying to figure out what a shape is doing.
  • Select the shape and go to “Format>Behavior”. This is another place that lets shape designers quickly customize how shapes behave in relation to other shapes and actions.
  • Is the shape a group? Many times, when editing doesn’t seem to “take” correctly, it is happening because the shape is made up of a number of different shapes grouped together. If this is happening to you there are several things to try:
    • Click on the shape, wait a couple seconds, then click again on the part of the shape that you want to work with. Depending on the shape settings, this will often allow you to select one of the sub-shapes of the group and work with it directly.
    • Select the shape then go to “Shape>Grouping>Ungroup”. This will break the shape into its components, which you can then manipulate independently.
    • Find the relevant shape in the Drawing Explorer window. This provides a finer grained way to select sub-shapes and gives you a better picture of how groups are set up. To do this, go to “View>Drawing Explorer Window” and then open the “Foreground Pages” node, then the correct page node (e.g. “Page-1”). This will give you a list of all of the top level shapes on that page. Find the main shape that you want to work with (as you select the items in the Drawing Explorer treeview the corresponding shapes will be selected in the diagram). Once you find the right one, you can expand the tree for the shape if it has sub-shapes and click through the shapes until you find the one that you want to work with.
  • Look at the ShapeSheet for the shape or sub-shape that you want to work with. In particular, look for cells that have formulas like “Guard,” “SetF,” and “SetAtRef”.

Remember that sometimes shape designers have disallowed particular operations for a reason, particularly in more technical drawings. When you change shapes to allow certain operations, you might break the intended behavior, particularly if the solution includes a code component.

This also is something to think about when you are designing your own shapes if you expect that others will use them. Make sure that you are not overly rigid in locking down behaviors unless the template really requires it – your users will thank you for it.

Next post, I’ll give a specific example of how to override the behavior of a particular shape: the rack diagram shapes to allow them to accept non-whole “U” sizes.