3 4
Just as vertices and line segments constitute basic shape geometry, lines and boxes represent the basic differences in shape behavior. Behavior means the way you interact with shapes on the page—that is, moving, sizing, and connecting them. When a shape behaves like a line, it can be stretched and rotated in one step by dragging an endpoint. For example, the Wall shape on the Office Layout Shapes stencil behaves like a line. 1-D shapes have this behavior. When a shape behaves like a box, it can have up to eight selection handles, including corner handles that you can use to resize the shape. 2-D shapes have this behavior.
Chapter 2 introduced the difference between 1-D and 2-D shapes. How much more do you need to know about 1-D and 2-D shapes? If you want to design your own shapes, you'll need to understand shape behavior, a fundamental Visio concept that helps you answer important questions: what kind of sizing behavior do you want your shape to have? Do you want your shape to connect to other shapes? If you create and revise shapes only as needed for different diagrams, it's still useful information, because 1-D and 2-D shapes look different when you select them and act quite differently when you use them.
A 1-D shape behaves like a line, but note that it doesn't necessarily have to look like a line, as Figure 22-4 shows. To identify a 1-D shape, select it, and then choose Shape, Behavior. If Line (1-Dimensional) is selected under Interaction Style, it's a 1-D shape.
Figure 22-4. You can tell these are 1-D shapes, because each has a begin point and endpoint.
Technically, any shape that has a begin point (the end with an ×) and an endpoint (the end with a +), either of which can be glued to other shapes, is 1-D. Together, these two points form part of the built-in intelligence of 1-D shapes. If other shapes are connected to the line, the begin and endpoints can imply directionality. The begin and endpoints also determine where the arrows and other line end styles go when you apply them with the Format, Line command, as Figure 22-5 shows. Only 1-D shapes can have line ends.
Figure 22-5. Visio applies the line end patterns to the begin point and endpoint when you select an option in the Begin and End lists.
InsideOut
A shape that has selection handles for changing width and height is a 2-D shape, as Figure 22-6 shows. To identify a 2-D shape, select it, and then choose Shape, Behavior. If Box (2-Dimensional) is selected under Interaction Style, it's a 2-D shape.
Figure 22-6. You can tell these are 2-D shapes because of the corner selection handles.
Visio includes two special types of 2-D shapes that can have confusing behavior:
For details about merged shapes, see "Merging Shapes to Create New Ones."
For details about groups, see "Working with Groups."
Shapes aren't the only objects in Visio with properties and behavior. Groups, imported graphics, guide lines, connection points, and even the drawing page are all objects in Visio. Like shapes, these other objects are represented in the ShapeSheet window. That means you can control them programmatically—a useful exercise when you want to automate diagrams.
You can convert a 2-D shape to a 1-D shape when you want a shape to behave like a line. In fact, the easiest way to create a 1-D shape is often to draw a 2-D shape, and then convert it. The important thing to remember is to draw from left to right so that after you convert the shape to 1-D, its begin and endpoints behave correctly. For example, if you draw the outline of an arrow using lines, you'll create a 2-D shape. If you want the arrow to connect to other shapes or align more easily, you can convert it to 1-D, as Figure 22-7 shows. When you convert a shape to 1-D, its handles change to begin and endpoints, and the alignment box is updated.
Figure 22-7. You can use the Behavior command to convert a 2-D arrow to a 1-D arrow that can be glued to other shapes.
Follow these steps to convert a 2-D shape to 1-D:
Tip - Reverse the Begin and Endpoints
After you convert a shape, make sure its begin point (×) is on the left or top and its endpoint (+) is on the right or bottom. If they're backward, you can switch them easily. Select the shape, and then choose Shape, Operations, Reverse Ends.
Converting a shape dramatically alters its ShapeSheet, which you need to know if you want to create SmartShapes formulas. After you convert a 2-D shape to 1-D, the Alignment section is deleted, the 1-D Endpoints section is added, and new 1-D formulas are added to the Width, Angle, PinX, and PinY cells of the Shape Transform section.
Shapes must be closed for fill patterns and colors to be applied. Closed means that the shape's line segments form a continuous path. The less precise way to think of this is that the line is sealed all the way around, so fill won't leak out. However, this analogy ultimately fails, as you'll see. Sometimes an entire shape is a closed path, such as a rectangle. Sometimes a shape contains multiple closed paths, such as a rectangle with polka dots. If you select the plain rectangle and click a fill color (let's say yellow), the entire rectangle turns yellow. If you select the polka-dotted rectangle, and then click the yellow fill, what happens? You might expect the dots to turn yellow, but perhaps you really want the rectangle around the dots to turn yellow, as Figure 22-8 shows. Either behavior can happen depending on how the shape was designed, which is why you need to consider the closed paths in shapes that you create.
Figure 22-8. In merged shape A (the Swiss cheese), the dots are open paths, and in merged shape B, the rectangle is an open path. In group C, the dots are a group, and they're grouped with the rectangle so that both the dots and the rectangle can be filled separately.
If the line segments in a shape are not continuous, the shape is open, which explains why you cannot fill certain shapes. For example, if you draw an arc, it's an open path, and you can't apply a fill color to it under normal circumstances. (However, you can edit the shape's geometry to accept fill. It's weird but true. For details, see the sidebar "How to Fill Open Shapes.")
When you're drawing 2-D shapes with the Pencil, Line, Arc, or Freeform tool, you must close the path if you want the shape to have a fill color or pattern. In practice, closing a path is tricky. If the last segment you draw doesn't overlap the first, the shape is open and can't be filled. You can use the Pencil tool to close an open shape or path in an existing shape.
You can fill just about any shape you want, including arcs, lines, and squiggles that don't look like their paths are closed. In the ShapeSheet window, you can define a shape to be closed even if it looks wide open.
Try it yourself: use the Pencil or Arc tool to draw a bowl-like curve. Select the curve, and then choose Window, Show ShapeSheet. Scroll down to the Geometry 1 section. (Click the heading to expand it if necessary.) In the cell labeled Geometry1.NoFill, the value is set to TRUE, meaning that it's true that you cannot fill this shape. Select the cell (not its label), type FALSE, and then press Enter. Now you can fill the shape. Close the ShapeSheet window, and then apply a fill color and see what happens.
Although it's possible to fill such shapes, does it make sense to do so? It's useful to know about the NoFill cell when you're working with shapes that have multiple closed paths, such as the rectangle with polka dots shown earlier. Such shapes can result from using a shape operation such as Combine to create a merged shape. Should the dots or the rectangle receive fill color? Maybe you want the entire shape, dots and all, to be filled. If so, you would want to know how to make the closed paths open. (Set their NoFill cell to TRUE.)
Tip
Follow these steps to close a shape:
When closing a line segment, the line stretches instead.
When you're dragging a vertex with the Pencil tool, it's easy to stretch the line accidentally instead of close the path. The ending vertex must align exactly with the starting vertex to close a path. If the vertices don't line up exactly, Visio creates a new line segment instead, and the shape isn't closed. It's sometimes easier to repair the problem if the shape is not selected. Then click the Pencil tool and draw a line segment from one vertex to another. To make the task smoother, try the following: