How to Make a Visio Stencil

I've always believed that a good illustration or diagram can be invaluable in explaining an idea. Just as people form first impressions of other people when they meet them, people form impressions about your ideas when they see them presented. A sketch on a napkin carries a sense of new-ness and excitement, but certainly not the expectation that a lot of details have been sorted out. Likewise, neat, professional illustrations convey confidence that the idea is valuable, important, and worth considering. You don't have to have a team of graphic artists working for you to make a good impression. Visio is already a powerful tool for creating diagrams and illustrations, and you can get even more mileage out of it by creating your own stencils. It's easy, and it'll help you create great drawings.

Why do you need a new stencil?

Visio's already got lots of stencils, or shapes - why would you need more? If you've ever tried to convey ideas specific to your industry or product, you know that the general-purpose shapes that come with Visio don't cover a lot of specialized needs. They also have a distinct style, which makes it hard to "brand" your drawings. But why not just drop pictures on your drawing? One reason is reusability - something that software professionals should be enthusiastic about. If you have a one-time picture, it's easy to drop it on your drawing and be done, but if you have an icon, symbol, or picture that you're going to use repeatedly, it makes sense to add it to a stencil. A good Visio shape will be sized correctly for use in Visio, and it will have connection handles so that you can hook it up to other shapes and lines. Typically, when you just drop a picture onto a Visio document, you don't take the time to set these things up, but if you do these things for your custom shapes, you'll be able to take advantage of them every time you use your shape.

Steps for a new Stencil

Ok, let's get started. I'm going to show you how to make a database shape that looks really nice. Of course, you can use the one that' built into Visio, but this one adds some real class to your doc. I'm using Visio 2003 here, but other versions are similar.

1. Pick your source image.

We're going to start with an image rendered by the Persistece of Vision (POV) raytracing program. I'm not going to attempt to do a POV tutorial here, but I've included the source for this image in the download if you want to play with it. The POV IDE lets you edit your file and render your changes. You'll find a Bitmap (bmp) right next to your source once you've rendered, and you can pick this up and start using it.

You can also grab an image from Google, a clipart CD, or a stock images web site.

2. Prepare the image.

Next, we'll resize the image and make sure its background is transparent. You'll need an image editor of some sort for this.  I'm using PhotoImpact, but Photoshop, GIMP, or any other image editor should work fine. First, select the part of your image you want to use, and make the rest of the image transparent. You want your shape to float over any other image content -- not clip it:

In PhotoImpact, the easiest way for me to do this is to select the part of the image I want using an "edge find" selector, then copy and paste into a new image. Next, create a new image with transparent background (a better tool would probably let you skip this step, but this allows me to create an image that's exactly the size of my selection), and paste the selection into it. Finally, change the properties of the selection to specify a transparent color (change the sensitivity or similarity to make white and gray, for instance, transparent).

Resize your image to a size appropriate for a Visio drawing. This will vary, of course, depending on the level of detail in your image and the size you expect to typically use in a drawing, but here's a point of reference: the small image in the download is 55 pixels wide by 70 pixels tall, and when used as-is in a Visio drawing, you end up with a shape that's 3/4" wide by an inch tall - a pretty good size.  You will be able to resize your image to be larger or smaller, of course, but if you leave your source image too large, you will cause every drawuing that uses that shape to consume more storage than it needs to.  On the other hand, if you make your image too small, you risk losing detail when your image is resized larger. Shoot for a size that's maybe just a bit larger than you think you need -- it'll survive resizing while consuming a reasonable amount of disk space.

When you're done editing, save the image as a PNG, which has the color depth of a JPG, but allows you to keep the transparent channel, like GIF.

3. New Stencil and Master.

Open Visio. The first time through, you want to create a new stencil to hold your new shape, so choose File ... Shapes ... New Stencil. You'll see a new panel in the Shapes area titled "Stencil1" or similar. Right-click on the title bar of this new stencil and Save As to change its name. By default, Visio will save your stencils into My Documents / My Shapes, which is pretty convenient compared to earlier releases of Visio.

Next, you want to create a new Shape, or Master. Right-click in area beneath the title bar and choose New Master. You should see a pop-up window similar to this:

Name your shape, and leave the other properties alone for now. Choose Ok, double-click your new Master's icon, and behold the big, empty grid. Don't worry - you're almost home.  Add your image onto the master by choosing Insert ... Picture ... From File... from the menu. Why not drag & drop? I've seen transparent-background images lose their transparency when dragged into Visio - if you Insert from the menu, this doesn't happen.

4. Add Connectors.


You'll want to adjust the zoom in Visio to make your shape easier to work with - try 200% or so. Next, we're going to add some connection points, because shapes in Visio are much more usable when they "stick" to one another properly. Choose the Connection Point Tool on the toolbar.  Now, hold the CTRL key and drop on some points. For a square or rectangular image, you'll want points top and bottom, left and right.  Larger shapes can use more connectors, and specialized shapes may call for points in specific locations - remember, these are the spots where lines and other shapes will attach, or snap to.

That's it - you're done! Click the document close "X" or choose File ... Close, and answer Yes to the prompt to save changes to your master. Your new shape is ready to use.

5. Repeat!

Once you've got a stencil, it's easy to add new masters. After a while, you'll have a collection of distinctive shapes that add a unique style to your drawings. Using them is easy and effective - they're going to work just like the shapes you already have.

54 Replies to “How to Make a Visio Stencil”

  1. Hi David-
    Where can I
    Hi David-

    Where can I download the source code for the pov-ray cylinder you created? I would like to produce something similar but am fairly new to using pov-ray…so the code would be helpful.

    Thanks,
    Melissa

  2. In January 2008, the Wine
    In January 2008, the Wine project announced official support for Photoshop CS2, allowing the Windows version of Photoshop CS2 to be used on Linux and other Unix platforms.

  3. I just found this article
    I just found this article and read your other one about how you couldn't find Gateway stencils. I was looking for some desktop stencils for Dell computers but now I can just make my own. Thanks!!

  4. Good – I'm glad this helped,
    Good – I'm glad this helped, and thanks for reading!

  5. I noticed that the solutions
    I noticed that the solutions folder that comes with Visio (C:Program FilesMicrosoft OfficeVisio101033Solutions) contains both Stencils (.vss) and Templates (.vst) files. How are they related? Do I need both?

  6. The templates, if memory
    The templates, if memory serves, are how you get new “drawing types” – so they will, among other things, define groups of stencils that are loaded automatically when you create that drawing type. The stencils are just your shapes.

    Thankfully, Visio started to use a “My Shapes” file in “My Documents” starting with Office 2003 (I believe). This makes it even easier to create your own shapes.

  7. I notice on alot of the DELL
    I notice on alot of the DELL stencils (like for the poweredge stuff) have stencils that act as connectors that you can glue to the rack stencils and stuff. I can't figure out how to do this…. It would be great.

    In the stencil, everything is hidden except for the connector. You can't select any of it unless you change the behavior to “members first”. I STILL can't figure out how they made the connector represent the entire stencil… plz help.

  8. I notice on alot of the DELL
    I notice on alot of the DELL stencils (like for the poweredge stuff) have stencils that act as connectors that you can glue to the rack stencils and stuff. I can't figure out how to do this…. It would be great.

    In the stencil, everything is hidden except for the connector. You can't select any of it unless you change the behavior to “members first”. I STILL can't figure out how they made the connector represent the entire stencil… plz help.

  9. I'm not positive I
    I'm not positive I understand the question, but if you're asking how to attach connectors to stencils, there's an “X” tool in the toolbar, but you have to find the pointer tool and drop the combo-box arrow to the right of it to change to the connector tool.

    Once you've selected the connector tool, click on the control you wish to add the connector to, then control-click in the spot where you want to add the connector. You can add as many connectors as you want – just be sure to click your target object first, or you'll add a connector that isn't attached to anything.

    If this isn't the info you're looking for, please let me know and I'll see if I can help.

  10. HI there,
    I am trying to create a stencil with all of my company's products in it. The steps you have provided have worked wonderfully, however, when I try to search for the shapes I have created, none are ever found. I have changed the properties of individual masters, providing keywords, but nothing works. Am I missing something here? Please help if you can.

    1. When you added your new shapes, did you add them to an existing stencil, or a new one you created? When you were done, did you save the stencil? (If not, that would account for the missing shapes).

      1. You know what, I think I figured it out on my own. My stencil was still in editing mode (even though I had saved it and moved on to other things), so it wasn't until this morning when I opened Visio fresh that I was able to search the shapes I had made. Apparently the only way to get out of editing mode is to close the stencil entirely and reopen it.

        Thanks for responding.

  11. How do I get the text box to appear below the shape? Right now, the text appears in the middle of the stencil.

    1. Use the “Text Block” tool – find the “Text Tool” on your toolbar (it's an upper-case “A”), and notice the little drop-down arrow next to it. If you click that arrow, you'll be able to select the Text Block Tool, and you can use this to drag your caption wherever you want it. This works with the shape when you're editing the master, or after you've dropped a shape onto your drawing.

      1. Using this idea, how do insert a text box such that when the user drags the master to their sheet, there is no text? and how do you make the textbox have a variable size? ie: increases width as user adds text.

        1. If you don't have any text in the text box in your master, you should end up with no text when you drag the master onto a drawing. The text box will have a variable size up to the width of your shape — after that, it will grow in length, wrapping onto multiple lines.

          If you want to have a text box that's wider than your shape, I think the easiest is to just grab a new text box in your drawing and link it to the shape. It's likely that there's a way to do this in the master itself, but I'd expect it to be reasonably complicated. To get a sense for the sort of modifications that *are* reasonably easy to accomplish in the master, turn on Developer Mode (in options) and look at the shape sheet for your master. You'll see all sorts of settings you can change, including the margins for the text box, but the overall width of the text box isn't one of them.

          1. Taa for the help. I'm gonna figure out how to do it in the master though. Determination! I'll post the solution when I find it.

          2. Got it!

            Edit the master. Click the shape for which you want the test to appear. Click the Window Tab and select show shapesheet.
            Click “Insert” Tab > Section > Tick “Controls”.

            Change shapesheet “Controls” parameters as follows:
            X =Width*0.5
            Y =TxtHeight*-0.5
            X Dynamics =Controls.Row_1.Y
            Y Dynamics =(Controls.Row_1.Y>Height/2)*2+2
            Tip (optional) =”Reposition Text”

            Change shapesheet “Events” params as follows:
            EventDblClick =OPENTEXTWIN()

            Change shapesheet “Text Transform” params as follows:
            TxtWidth =TEXTWIDTH(TheText)
            TxtHeight =TEXTHEIGHT(TheText,TxtWidth)
            TxtAngle =IF(BITXOR(FlipX,FlipY),1,-1)*Angle
            TxtPinX =Controls.Row_1
            TxtPinY =Controls.Row_1.Y

            If you want to modify the font size – Change shapesheet “Character” params as follows:
            Size =X pt (Where X is your font size)

  12. Many thanks for the article, will be able to creat many templates now, myself and Morph can now take over the world 🙂

  13. Many thanks for the article, will be able to creat many templates now, myself and Morph can now take over the world 🙂

  14. Turning the background transparent was a lot of help. If I manually attach connectors to points, everything looks fine. For some reason connectors are still being obscured by the fame of the object if I allow them to snap with the red frame on.  This is not the case with shapes that come with Visio. With native shapes, the connectors always touch the object itself no matter how odd the shape. Can you help?

  15. Turning the background transparent was a lot of help. If I manually attach connectors to points, everything looks fine. For some reason connectors are still being obscured by the fame of the object if I allow them to snap with the red frame on.  This is not the case with shapes that come with Visio. With native shapes, the connectors always touch the object itself no matter how odd the shape. Can you help?

Comments are closed.