If you want to use a fill pattern, line pattern, or line end not available in Visio, you can create your own. Custom patterns are powerful and peculiar. They work roughly like this: you create a shape and tell Visio to use it as a fill pattern, line pattern, or line end. You specify the attributes you want, and then Visio adds your pattern as an option in the Fill or Line dialog box. You can then apply the pattern to a shape in the usual way.
The pattern you design is a simple shape or group, as Figure 23-11 shows. The options you set for your pattern determine the way it looks when applied to a shape. The results can be dramatically different, as Figure 23-12 shows.
Figure 23-11. To create a custom pattern you design the single element that will be repeated when the pattern is applied; in this case it is a simple x shape.
Figure 23-12. You can design a variety of fill patterns, line patterns, and line ends, and then apply them to shapes. The same simple pattern—the x shape—looks very different when applied as a fill pattern (A), line pattern (B), or line end (C).
The actual process for creating reliable patterns is somewhat complicated. That is, it's easy enough to draw a shape and define it to be a pattern, but it's an entirely different matter to get the results you want when the pattern is applied. That's where the "powerful and peculiar" come in. There are a lot of tricks to designing a shape that can be applied as a pattern, and Visio gives you many options to consider as well: will the pattern ever be applied to shapes in a scaled diagram? Do you want the pattern to be tiled across a shape or stretched to fill it? What should happen to the pattern when a shape is stretched or a line is bent? The answers to these questions are the pattern's behavior, which you define when you create the pattern.
The only way to create a pattern is through the Drawing Explorer window. To open it, choose View, Drawing Explorer Window. The Fill Patterns, Line Patterns, and Line Ends folders store new patterns that you create or other custom patterns that come with certain diagram types, as Figure 23-13 shows.
Figure 23-13. To create a new pattern, right-click a pattern folder, and then click New Pattern.
After you've created a pattern, you can apply it to other shapes as you would any of the built-in fill and line patterns. Depending on the type of pattern you design, your pattern appears as an option in the Fill or Line dialog box, as Figure 23-14 shows.
You can create a master pattern from a shape you create in Visio or a shape that already exists and set its properties, which affect how the pattern behaves. For example, you can choose how the pattern will appear when it's applied to a shape, how it responds when the shape is resized, or how it responds when the drawing page scale changes. You draw the pattern shape in a drawing window that Visio opens when you choose the Edit Pattern command by right-clicking a pattern in the Drawing Explorer window. The pattern's drawing page looks just like the regular drawing page or the drawing page for a master shape. When you work in the pattern's drawing page, the menus and toolbars display all the commands and tools you can use in designing your pattern. Table 23-1 lists the fundamental techniques to use and avoid when creating your own patterns.
Figure 23-14. Patterns you create appear at the bottom of the list of available patterns. Here, custom-designed line patterns are shown.
Table 23-1. Dos and Don'ts for Creating Patterns
Create a pattern as a single instance of the design that repeats. For example, you can design one square as a pattern that repeats to form a checkerboard.
Use multiple shapes in a pattern unless you group (Ctrl+G) or combine (choose Shape, Operations) them.
Use Visio's drawing tools.
Use Visio patterns in your pattern. For example, your pattern design cannot use a gradient (graduated color) fill.
Copy an existing shape.
Use a bit map image or metafile in your pattern—they won't show up when the pattern is applied.
Design a pattern in black and white Then, when you apply the pattern, you can click a new line or fill color to change the pattern color.
Use color in your pattern design unless you want the pattern to keep its color. For example, a green pattern stays green.
When you design a shape to use as a pattern, shape geometry is a big factor in how the pattern will be applied. You can choose different pattern behaviors that specify how the pattern is repeated on a shape, but when you design the pattern itself, you want to use a shape or shapes that will be positioned in a predictable way. Visio uses your pattern shape's pin and alignment box to determine where to put the pattern. A shape's pin is its center of rotation, a point that you can move. A shape's alignment box is its bounding edges, which don't have to match the shape's width and height.
Should the pattern's pin be in the center, on an edge, or in the corner? When you create a new shape, Visio automatically places the pin at its center, and uses it as the center of rotation. In a pattern, Visio uses the pin to align the pattern shape to the shape it's being applied to. If you move the pin, you can affect the position of the pattern as it is tiled along a line or repeated as fill, as Figure 23-15 shows. The easiest way to adjust pin position is to display the Size & Position window (choose View, Size & Position Window), and then use the Pin Pos option.
Figure 23-15. Visio repeats a line pattern based on its pin position.
Should the pattern's alignment box tightly enclose the shape? Typically, a shape's alignment box is the same as its outer edges. In a pattern, Visio uses the alignment box to determine whether the pattern overlaps as it is tiled along a line. You can make the alignment box smaller or larger than the shape it encompasses. A small alignment box can produce a fish-scale effect. A large alignment box (shown in Figure 23-16) leaves spaces between repeating pattern elements.
Figure 23-16. The alignment box for this pattern shape is slightly larger than the shape itself. When applied, the pattern will leave space around the repeating shape.
Changing the size of a shape's alignment box requires some fancy footwork. The easiest way is as follows:
Now all that remains is your pattern shape, surrounded by the alignment box that was set by the size of the group.
A fill pattern is applied to the interior of a closed shape. Visio can tile, stretch, or center a pattern to fit the shape, but the most common pattern behavior is to tile, or repeat, a pattern. That's how a single dot becomes polka dots and a single square becomes a checkerboard pattern. Figure 23-17 shows the three basic fill pattern behaviors.
Figure 23-17. You can design a fill pattern that tiles when applied to a shape (A), is centered in a shape (B), or stretches to fill a shape (C).
Visio applies your pattern design differently depending on the behavior you select:
When you're designing a pattern for use in a scaled drawing such as a floor plan, you'll get better results if you set the pattern's drawing page to the same drawing scale. If the scales don't match, Visio will try to apply the pattern anyway. A tiled pattern can end up looking like solid black. If the scale of the pattern is more than eight times larger or smaller than the scale of the shape you're applying it to, Visio ignores the pattern's scale altogether. Unscaled patterns stay the size that you designed them to be. For example, if you create an unscaled pattern that's ¼ inch in height, when you apply it to a shape in either a scaled or unscaled drawing page, the pattern design will still be ¼ inch in height. Issues of scale and pattern size don't apply when you design a pattern with stretching behavior.
When Visio repeats your pattern in a shape, the space between the repeating elements is transparent unless you design the pattern to use a solid color. For example, if your pattern looks like a black circle, and you apply it as a tiled pattern to a square, the square will be filled with solid-color polka dots with transparent areas between the dots. Anything behind the square shows through. You have replaced the shape's solid (white) fill with a new fill (polka dots). The solid fill is gone, so there is nothing to hide the background. Or you can think about those polka dots like this: you are tiling your shape with imaginary squares. Each square is the alignment box of a circle; it contains the circle, and nothing else. If you want dots with a white background, put a white square underneath your dot (with line pattern = None). If you want the white to stay white, make it RGB(254, 254, 254) instead of color index 1.
To create a fill pattern, follow these steps:
Select tiled behavior, and the pattern will repeat to fill a shape.
Select centered behavior, and the pattern will be centered on a shape.
Select stretching behavior, and the pattern will stretch to fit a shape.
When you design a shape to use as a line pattern, you need to consider the way that Visio will apply the pattern to both straight and curving lines of varying degrees of thickness. Visio applies a line pattern in one of the following ways:
Visio uses the pin of your pattern shape (that is, its center of rotation) to align the pattern to a line. Figure 23-18 shows examples of each type of pattern behavior.
Figure 23-18. The single, repeating element in each of these line patterns is an x shape. In pattern A the x is tiled and bent to follow the line. In pattern B the x is tiled but not bent. In pattern C the x is stretched along the line, and in pattern D the x is tiled at intervals like beads on a string.
Each of the four line pattern behaviors has an additional option: scaled or unscaled. When you design a scaled line pattern, Visio resizes the pattern when it's applied—the height of the pattern shape's alignment box is set to match the line weight.
To create a line pattern, follow these steps:
Select bending behavior, and the pattern bends as it is repeated around curves.
Select brick-style behavior, and the pattern repeats without bending along a line.
Select stretching behavior, and the pattern stretches along a line. Visio doesn't repeat the pattern design.
Select beads-on-a-string behavior, and the pattern resembles strung beads.
Most people think of line ends as arrowheads, but many technical drawing types use unique line ends to convey meaning. For example, line ends in software and database models define relationships between objects, whereas in piping diagrams, they show the direction of flow. Line ends are easier to design than fills or line patterns, because they're really just shapes stuck on the ends of a line. The behavior options you have boil down to the direction your line ends will point. Visio provides two options, as Figure 23-19 shows:
Figure 23-19. You can design line ends to rotate in-line with the line to which they're applied or remain upright despite the line's direction.
Visio aligns the pin of your line end shape to the endpoint of a line. If you move the pin to the edge of the line end that you want to attach to the line, and then specify the in-line behavior, you can get the same effect as the built-in, solid arrowhead line ends in Visio. In addition, how you draw the line end pattern affects its application. Do the following to ensure your line ends behave as you want them to:
Whether the line ends are in-line or upright, they can be scaled or unscaled, which affects their size when applied to a line, as Figure 23-20 shows. If your pattern represents a real-world object in a scaled drawing, design the line ends to be scaled. When the line end is applied to a line, the Size and Weight settings in the Line dialog box will have no effect on the size of a scaled line end. If your pattern isn't scaled, Visio can resize the line end when it is applied—the height of the pattern shape's alignment box is set to match the line weight. For this behavior to work, you must set the Begin Size and End Size to Medium (the default) in the Line dialog box when you apply the line end pattern. If you choose any other Size setting, from Very Small to Colossal, the line end is sized in the usual manner.
Figure 23-20. An unscaled line end sizes with the line weight. A scaled line weight remains the size you created it, regardless of line weight settings.
A custom line end pattern doesn't appear when you apply it to a line.
If your line end isn't visible after you apply it, and you designed it to be unscaled, adjust the line weight. Select the line, choose Format, Line, and then in the Weight box, scroll down to select Custom. Type a thicker line weight, such as 12 pt. or .25 in.
To create a line end pattern, follow these steps:
Select in-line behavior, and the line end points in the same direction as the line.
Select upright behavior, and the line end stays upright as the line is moved.
The next step is to get the line end to show up at an appropriate size on a line. If you've designed an unscaled line end, and you apply it to a Visio line of the default size, the line ends probably won't be visible. You'll have to adjust the line weight.
Follow these steps to apply your line end pattern: