Sunday 14 June 2015

SmartSize

A Free Document Productivity Tool For Visio

This post provides a tool to resize a group of shapes based on the size of the first one selected.  It assigns the shapes to a group so that the group can be selected and moved, and be easily resized to conform to the new size any one of them.

This is the first in a series of productivity tools for Visio that are avaialble for free download. The tools in this series are:
  • SmartSize –Making a group of shapes the same size and allowing them to be resizing later.
  • SmartAlign – Aligning a group of shapes and allowing them to be realigned later.
  • BreakLinks – Disconnecting the connectors from a shape so that it can be moved without dragging the connectors out of place.


Using the Tool

First, select the shape that you want the others to be resized to.

Second select one or more other shapes.  Note that the first shape has a darker purple boundary than the other shapes.


Finally, Press the shortcut key (Ctl+m)to resize the shapes to the size of the first one selected.



Using the tool on these shapes later.

When a set of shapes is resized, they are assigned to a group.

If you select any one of those shapes  and press the shortcut key.  The rest of the group is selected.




A second press of the shortcut key will resize the group to confirm to size of the first of the group just selected.




You can add to the  group by holding the control key and selecting further
shapes with the mouse.  Clicking on a selected shape while the control button is held down will deselect it.  When the shapes are resized, the deselected shape will be removed from the group.

How the Tool Works

When the tool is invoked, it steps through the shapes in the selection group. 

It always processes the first shape selected first.  The tool assigns the width and height of this shape to variables and then sets the width and height of the subsequent shapes to these same values.

The width and height are cells that can be found in the ShapeSheet, which can be revealed by selecting the Show ShapeSheet option when right clicking on a shape or from the Developer Tab.

After the width and height have been updated for each shape, the code makes a second pass through the shapes, and assigns them to a group.  

The group is defined by adding a custom property to each ShapeSheet called “dpSizeGrp”.  The code assigns the value UniqueID of the first shape to this property for each member of the group. If there is a further resizing, the property value is updated with a new group ID.

When the shortcut key is used, the routine checks the number of selected shapes.  If there is only one shape selected, the value of its “dpSizeGrp” property is noted.  The code then steps through every shape on the page checking for the sane “dpSizeGrp” value and adding it to the selection group when one is encountered. In this way, the original group is reseleted.

Inspiration

I use this tool frequently, especially when preparing presentation-style diagrams when presenting text boxes that need to be of consistent size for layout reasons.

Visio does allow a quick group resize function, but it requires manual entry of the width and height. I prefer this option that resizes by example, rather than by entered values, and the grouping function helps manage the group and allow really quick adjustment later, should I choose to use it.

The code for this tool provides a good example of how to update the ShapeSheet and change the appearance of a shape through code.

To remember the short cut key (Ctl+m) I think of Control + same size.

Downloading the shapes

You can download the template and the related stencil shapes from the Visio Downloads page here.

If you like the tool, please leave a comment please leave a comment.

Look out for the SmartAlign tool in a later post.















No comments:

Post a Comment

Please add comments, encouragement and suggestions. You can be anonymous if you want.