There was a question on the Visio forum recently on how to modify a built-in shape and I thought I'd jot down a quick walkthrough of how you might approach the problem. In this instance I’m going to change the way the line weight scales, but the principle of how you modify and create your own master will be the same in most cases.
The basic workflow will be as follows:
- copy the target shape to a new blank document
- make changes as required
- drop the shape into the document stencil to create a new master
- copy the master to a new convenient location
The following is based on Visio 2013, but it’s exactly the same process in 2010 and bar ribbon UI differences previous versions as well.
The problem to solve
The problem I’m trying to solve here is that the 3D printer shape has fixed values for line weight which, while working perfectly well in most situations, don’t scale correctly when the shape is shrunk beyond certain limits. Here’s a couple of screenshots comparing, on top, the standard drop size (1 inch) and, on the bottom, the scaled down size (0.255 inches):
There are a couple of approaches here. Firstly, and most simply, you could change the drawing scale, which is 1:1 by default, and then increase the page size all under Design / Page Setup (Shift+F5). Alternatively, you could open up the ShapeSheet and change the sizing behaviour. In this post I’m going to look at that second option as the method offers greater scope for changes beyond this particular problem. So let’s get started…
If you haven’t already, make sure the Developer option is checked under File / Options / Advanced / General / Run in developer mode. This will give you another tab (Developer) from where you can reach the ShapeSheet and other handy tools like the Drawing Explorer.
If you’ve not come across the ShapeSheet before then you might be interested in the first part of this post – Just for starters.
- Create a new ‘Detailed Network Diagram – 3D’ document, under File / New / Categories / Network
- Create another new document, this time a blank one, under File / New / Featured / Blank Document
- From the network diagram document, select the Network and Peripherals – 3D stencil and drag and drop a Printer onto the page
- Now copy the Printer instance shape in the network diagram document, flick over to the new blank document (Ctrl+Tab) and paste it onto the new page. (Note – you could just open the respective stencil in in your blank document, but either way gets you to the same place – a new instance shape, in a new document.)
- Close the original network diagram document as you’re now finished with it.
- In the blank document, tick the Developer / ShowHide / Document Stencil checkbox to display the masters for the new document. You should see a master named Printer, which was created when you first pasted the shape into the document.
- Right click on the Printer master and delete it, clicking OK to the warning dialog that pops up. (Note – it doesn’t really matter whether you delete the master and edit the instance shape (followed by recreating a master from the instance) or just edit the document master shape directly. For new shapes my preference is the former option as you have one less window to handle and it’s easier to create multiple versions of the same shape to try out different scenarios before finally creating a single master.)
- Now open the Drawing Explorer and expand the treeview to display both the Printer and its sub-shapes:
- If you look down the tree you’ll see that the sub-shapes all have a ‘Sheet.’ ID and if your printer shape was the first shape on the page then ID’s should be similar to the above image. If not, it doesn’t matter – Visio allocates ID’s so that they are unique on a page and so it depends on what other shapes (and their ID’s) are already on the page as to how an ID is allocated. (Note – The Drawing Explorer orders its nodes alphabetically, so don’t get caught out thinking it reflects shape z-order. Alas, that’s not the case.)
- The next step is to click through the sub-shapes, using the Drawing Explorer, to find which shapes have those fixed values so that you can change them to a scaled one. In keeping with a number of Visio shapes the Printer shape has a thick outer border sub-shape which you can attack first. In the case above it’s Sheet.14, so right click on that to display the ShapeSheet:
- In the ShapeSheet, scroll down to the Line Format section and observe that the LineWeight cell uses a GUARD function to fix the line weight at 1.5pt. This function just prevents the cell from being overwritten by user actions.
- Given that the shape was designed with this line weight at a standard size of 1 inch you can now adapt the formula so that the resulting value scales as the Printer (group) shape size changes. (Note – the Printer’s aspect ratio is locked so you can just use Width as the size factor):
- As an alternative, you might decide that the purpose of this outer border shape is to provide a reasonable outline and clarity when presented at a small size, but not to remain heavy as the shape is scaled up. If that’s the case you could modify the formula again to ensure that the line weight doesn’t go beyond that 1.5pt limit by surrounding it in a MIN function:
- So that fixes the outer border, but you might find that you want to apply a similar formula to the other shapes that have the same problem. Continue clicking through the sub-shapes to identify the one’s you’re after.
It’s not always easy to see which shape is which, so one method that I use is to open the ShapeSheet and just change the LineColor cell to red (2) temporarily (followed by Ctrl+Z to undo) to see exactly which shape I’m dealing with.
In the above (Drawing Explorer) image all sub-shapes with the exception of 2,8 and 14 took a line weight of 0.72pt (instead of 1.5pt) and Sheet.8 (the green button) took a weight of 0.24pt. So now, adapt the formula for each of the shapes you want to change and note that the group shape reference is still ‘Sheet.1’ for all of the sub-shapes.
- Having made all of the changes you want to make, you’re now ready to create a master shape (if you didn’t edit the existing one). So drag the instance shape back onto the document stencil and right click on the new master to edit its properties:
- Rename your new master ‘Printer’, check the ‘match master by name on drop’ checkbox and OK to close the dialog.
- You can now copy the new master into your target document’s document stencil, add it to another separate stencil or just drop it into your My Shapes using the master context menu.
One point on adding an adapted master back into your workflow is that it can’t have the same name as an existing master. So where you’ve got an existing document with, for example, Printer instance shapes already, you either need to remove them, including the document stencil master, and replace them with the new one or, make your changes to the existing master. Be aware, though, that not all changes made to a master will always be reflected in existing instance shapes.
So I hope that helps in understanding the process of modifying master shapes, but if you interested in extra information around the subject then some good resource can be found here: