How Big Is My Shape?
Whether you’re a Visio end-user creating measured drawings, or you’re developing a Visio solution with customized Visio shapes, at some point, you’ll want to know how big your shapes are, and how to precisely resize them.
There are several ways to do this, and many of them allow you to edit the data as well. Today’s post offers a run-down of the many ways that you can edit and view the size of your Visio shapes!
Let’s list a quick overview of the shape-size related areas we’ll talk about today. They cover the user interface, masters in stencils, and automation code:
- Size & Position Dialog
- Status Bar
- Ruler & Grid
- Dimension Lines
- Wall, Window & Door shapes
Size & Position Dialog
The easiest way to view and edit the size of your shape is by using the Size & Position Window. You can show and hide this window via: View > Edit > Size & Position Window.
You can also the position and angle of the shape, along with the Pin location on the shape itself. The Pin is the point which positions the shape on the page. CAD users might think of it as the “insertion point”. The Pin is also the point about which the shape rotates when you change the angle. So the Pin actually has two important positions: the point where it hits the page, and the point where it passes through the shape!
The Size & Position window shows information about the selected shape. If more than one shape is selected, then the windows shows data pertaining to the primary selection, which is the first shape that is selected. You can tell which shape is the primary selection because it has darker, thicker highlight-line than the other selected shapes.
If more than one shape is selected, edits that you make in the window will apply to all selected shapes, so this is a great way to give many shapes the same size attributes!
Way down at the lower-left of your main Visio window is the status bar. When you select shapes with the pointer tool, the status bar shows the Width, Height and Angle of the primary selection.
Ruler & Grid
The rulers on the top and left side of the drawing window, along with the page grid allow you to quickly gauge the size of your shapes.
If your shapes don’t need to be odd sizes to three decimal places, then using the rulers and grid, along with the corresponding snap settings can be the quickest way to get your shapes to be the right sizes.
You can toggle the rulers and grid on and off via: View > Grid and View > Rulers. You can change the snap settings for your drawing under: Tools > Snap & Glue or click the toggle buttons on the Snap & Glue toolbar.
Dev-types might already have discovered the ShapeSheet. This is the spreadsheet-like interface behind every Visio shape that defines the size, position, geometry, protection, Shape Data fields, and other attributes of a shape.
If you click Window > Show ShapeSheet, you’ll see something like the window below. At the very top of the window are cells that hold values for Width and Height, as well as many other size and position-related values.
In addition to values, the ShapeSheet can also accept Excel-like formulas. This allows shapes to reference each other, or contain conditional logic–the building blocks of Smart Shapes!
If are interested in learning more about creating Smart Shapes and adding intelligent behavior to your Visio shapes, then have a look at John Goldsmith’s excellent “getting started” article:Just For Starters.
Dimension Line Shapes
There are several stencils that ship with Visio that are full of dimension lines. You can drag and drop various dimension lines into a drawing page and place them on your shapes to show how big they are.
If you turn on Snap to Shape Vertices, then it’s easy to snap the dimension line ends to vertices on your shape. You can even turn on Glue to Shape Vertices and the dimension line will follow along when you stretch or shrink your shape!
The dimension line stencils can be found in the Visio Extras folder. Or you can get to them via: File > Shapes > Visio Extras. There are three stencils:
- Dimensioning – Architectural (US Units)
- Dimensioning – Engineering (US Units)
- Dimensioning – Engineering (Metric)
If you’re creating a building- or office plan, then you’ll be using shapes from the Walls, Doors and Windows stencil. This stencil contains shapes that show their length only when they are selected:
This effect is created with a combination of ShapeSheet smarts and add-on code. (The add-on program ships with Visio, and is part of the office and building plan solutions. You can’t see the code, and you don’t need to worry about installing extra programs or enabling any add-ons)
If you’re into programming, then you’ll want to be able to get and set information in Visio shapes. The code snippet below shows how you can read the values and formulas for the Width and Height of a shape that is selected in the active drawing window:
Sub WidthAndHeightStuff() Dim shp As Visio.Shape Set shp = Visio.ActiveWindow.Selection.Item(1) '// View Width and Height values and formulas. Note: '// ResultIU returns values in inches - the internal '// units that Visio uses: Debug.Print shp.Cells("Width").ResultIU Debug.Print shp.Cells("Height").ResultIU Debug.Print shp.Cells("Width").Formula Debug.Print shp.Cells("Height").Formula '// Set the values for Width and Height:using '// two different methods: shp.Cells("Width").ResultIU = 1.5 shp.Cells("Height").Result("mm") = 2.54 End Sub
Note how you can set the result in either Internal Units (IU) or specify the units that you want to enter.