Techniques for creating Visio Shapes

Most Visio users barely scratch the surface when dealing with the product. I recently watched a video where a Visio expert dropped a shape on a page and then used the Text tool to create a label for the shape. All Visio shapes have a text block and there is a Text block tool if you do not like the positioning or orientation of the text, you can change it. So, why is that a big deal? Visio is a database of information and if you want to create a report on the Visio drawing, the label will not be associated with the shape, it will be a separate shape.
A lot of Visio users are unaware of the Shapesheet and can survive without that knowledge. The techniques I an going to show do not require using the shapesheet, but a little peak under the hood with a Shapesheet will help you understand what is going on.
Developer Mode If you are going to be creating shapes, you should turn Developer Mode on.
File -> Options -> Advanced -> (scroll to the bottom) Check mark  Run In Developer mode
or
File -> Options -> Customize Ribbon -> on the Main Tab Check mark  Developer
You will have access to the Developer ribbon with Operation commands and a few other goodies.
Shapesheet The shapesheet is a way to view the internal structures within a Visio drawing. In addition to a view of a shape, there are shapesheets to see some of the internals for the Visio page and the Visio document. The shapesheet is divided into sections and each section is a table of values or lists of rows of values. Most sections are unique, but the Geometry section may have several.
Image Source So, how do you create shapes from scratch to create a Visio drawing? First find a drawing you can use as a template that has the right proportions or dimensions. Should it be a vector or raster image? Vector would be nice, but sometimes it causes more problems than it is worth. what may look like a rectangle could be a set of four disconnected lines. I did a series of flags and the stars were actually triangles. Luckily Visio allowed me to select the star field and use the Union operation to simplify the stars. The result was a group of individual stars. Then there is the time taken to remove superfluous shapes. So, unless I get quick results with vector diagrams, I go with raster.
“Template” (old school definition) Visio will allow you to drop most image files into a Visio drawing, I then put them on a locked layer and use them as a template (old school definition) to draw the shapes with basic geometry shapes. I build up a collection of rectangles, circles and other basic geometries. With the Visio operations you can create some interesting shapes, but you have to plan the operations. Should you Union first or Fragment?
Scaling Visio is an engineering drawing tool and understands dimensions. When dealing with shapes with known dimensions, you need to be able to resize your “template” so it is the proper size. I have done this by adding a rectangle that has text that displays the rectangle’s height and width and placing it over something with a known dimension. Select the template and the rectangle and stretch (keeping the aspect ratio fixed). when the dimension in the text block matches the desired value, you have the right size. I have also written VBA code that sets the templates size by using two reference rectangles. One is set to a known distance on the template and the other is set to the actual dimension. The VBA code works out the ratio of the two rectangles and applies it to the template.
Basic Geometry shapes You can use the Pencil tool to create a shape, but it will be difficult to keep the lines straight and the angles of the line correct. It is far easier to lay out a set of overlapping rectangles and circles and then use the Union command to get the desired shape.
Gaps If you put two shapes adjacent, but not quite, you may get a gap between the shapes when you do a Union. Undo the Union and put a rectangle as a patch bridging the two shapes. The patch does not have to cover the full gap. It is not worth the time trying to get the patch perfect. Reselect with the patch and redo the Union. Rather than a gap you will have two fingers that can be easily fixed with the Pencil tool. Use the Pencil tool to select the corners of the fingers and delete. The Pencil tool can delete any other unwanted points.
Rounded Corners If you want a rectangle with rounded corners, you can draw a rectangle and then chose Line -> Line Options… ->and set the Rounding size. Then Developer ->Operations -> Union. This may not seem to do anything, but if you had looked at the shapesheet before and then after, the Geometry section would contain a RelMoveto and three RelLineTos, afterwards they would be interspersed with EllipticalArcTos and the Rounding setting in the Line Format would go from non zero to zero. You can do it to only some corners by duplicating the shape, align the two shapes Center and then Middle and just select the top shape and set the rounding on that. Select both shapes and do a Fragment. Delete the unwanted corners and then select the shape and the wanted corners and Union.
You can also create inside corners by placing a circle inside a larger square, centering them and then use lines to bisect.
Parallel Lines Having stripped shapes is common, making them is easier. Draw a line, duplicate it many times. Select the lines, align on center and then Distribute. You can then Join or group the lines.
Matching Curves  Trying to make matching curves is not easy. On one project I had to make a cylindrical shape that was intersected by a smaller diameter cylindrical shape. It was a container with a spout that went off at an angle. So, I created two rectangles and resized and positioned them appropriately. The smaller diameter cylinder overlapped the large diameter cylinder. I duplicated the smaller diameter cylinder and aligned the two copies to the same place. I selected the larger cylinder and a copy of the smaller diameter cylinder and did a Union. I then used the Pencil tool to remove the ends of the smaller cylinder from the large cylinder. What I was left with was what looked like the larger cylinder, but one of the side walls had two points at the location where the two cylinders intersected. Using the Pencil tool I was able to bow that section to make the intersection visible. I duplicated the larger cylinder and aligned them to be in the same place. I then took the copy of the larger cylinder with the smaller cylinder and did a Fragment. I then had a spout with a matching curve to the large cylinder. I then deleted the remaining part from the Fragment operation.
Groupies When shapes are grouped, a new shape is created and the selected shapes become sub shapes of the group shape.  Grouping is very useful for keeping subshapes together, but you can get carried away. When your shape is ready, you should go back through the shape and remove any non essential grouping. Actually, you probably should remove all groupings and select all the component shapes and group. Then add things like Shape Data and Control handles and Connection points. You may want to keep a backup copy of the shape with the groupings if you need to rebuild.
Connection Points The normal connection points handle standard situations, but what if you are creating a piece of electrical equipment and you want the connection points to be where the wires connect? Use the Connection Point tool.
Cleanup When you have finished your shape, you should remove all the Groupings and Creating a new Group of the parts. Then add Shape Data.
Almost Black My favourite technique is still Graham Wideman’s almost black. If a line or fill colour in a custom line patter or custom fill is black, it is replaced by the chosen foreground colour. If you want something to be black, it needs to be something that is almost black(255,255,25) like (254,255,255) or (255,254,255) or (255,255,254)

The next set of techniques in a followup article, will go into leveraging the shapesheet.
If you want to learn more about Visio shape developing, check out Chris’s Visio Guy website there are a lot of articles and forums to handle questions.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s