Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
7 out of 16 rated this helpful - Rate this topic

Step-by-Step Guide to Building Shapes in Visio 2003 ShapeStudio

Office 2003
 

Saul Candib
Microsoft Corporation

February 2005

Applies to:
    Microsoft Office Visio 2003 Editions

Summary   ShapeStudio is a shape-development tool included in the Microsoft Office Visio 2003 SDK, providing a work environment that integrates with Visio. This article provides a step-by-step description of how to create shapes in ShapeStudio. It shows how to create a project, add base masters and masters to the project, assign behaviors to the masters, create and assign behavior sets, and then apply, test, and validate those behaviors. It also shows how to create and build a stencil to hold the shapes. (25 printed pages)

Contents

Introduction: Shape Development in ShapeStudio
Installation and Setup of ShapeStudio
Major Steps in Shape Creation
Description of Example Shapes
Create a Project
Create a Base Master
Add Shape Geometry to the Base Master
Assign Behaviors to the Base Master
Apply Base Master Behaviors and Validate the Base Master Specification
Create Masters Based on the Base Master
Define Styles
Add Shape Geometry to the Masters
Assign a Behavior to the Master
Apply Behaviors and Validate the Master Specification
Create More Masters
Create a Set of Behaviors
Use Developer Tools to Modify Masters
Use Test Tools to Test Masters
Create a Stencil Specification and Assign Masters
Assign Properties to the Stencil File
Build the Stencil File
Validate the Stencil
Create a Project Report
Conclusion
Additional Resources

Introduction: Shape Development in ShapeStudio

ShapeStudio is a development and productivity tool for groups or individuals who design and develop Microsoft Office Visio shapes. ShapeStudio provides a work environment in Visio that facilitates specification, design, development, and verification of custom smart shapes, and management of shape-development projects.

Note   All of the ShapeStudio concepts and elements mentioned in this article are defined and discussed in more detail in the companion article Getting Started Developing Shapes in Visio 2003 ShapeStudio. If you are not already familiar with these concepts, read that article first.

ShapeStudio is a great tool to use to develop shapes for the following reasons:

  • Visio shapes can have simple or complex geometry and behavior. For example, a rectangle that has no custom properties or specialized behavior is a simple shape. And a complex shape might, for example, be composed of several simple shapes grouped together (complex geometry) or might change its appearance based on user input (complex behavior).

    Although developing a simple shape in Visio is easy, developing shapes that have complex geometry or behavior is difficult and requires specialized knowledge. In particular, you need knowledge of the Visio ShapeSheet spreadsheet, where shape geometry and behavior definitions are created and stored. While a knowledge of the ShapeSheet is important, even in ShapeStudio, you can apply numerous behaviors to the masters you create without ever opening the ShapeSheet window.

  • The behaviors built into ShapeStudio are implemented by using the best practices of Visio shape development, so you can examine the ShapeSheet of masters to which you apply behaviors in ShapeStudio to study these best-practice implementations.
  • ShapeStudio provides consistency in newly developed shapes. You could implement the same behavior in a variety of ways in the ShapeSheet (such as by using different formulas) or in different locations (sections or cells) within the ShapeSheet, which could introduce errors or lead to inconsistent results. With ShapeStudio, behaviors are applied the same way every time.
  • ShapeStudio lets you create generic base master shapes, which act as templates from which you can derive more specific master shapes that can be compiled into stencils. Master shapes inherit behaviors and values from their associated base masters. (You can, however, change the behaviors of an individual master to override or suppress behaviors inherited from a base master.)

    In this way, you can easily create families of related shapes without having to recreate each shape from scratch. In this article, for example, you learn how to create a family of related flowchart shapes derived from a single flowchart base master.

  • ShapeStudio stores master and stencil specifications and all data associated with shapes and projects you create independently in a database, not in a Visio document. This makes it easier for different aspects of shape-creation to be handled by different teams or companies, because each individual or team can work in a separate document while all are working together on the same project.
  • Masters and stencils must be checked out from the database before they can be edited, which provides tighter control over shape versioning. Teams of designers, developers, and testers can work cooperatively, with less chance that the work of one team can be cancelled by the work of another.
  • ShapeStudio provides tools to aid in shape development, such as the Find and Replace Cells tool, which lets you make changes to the ShapeSheet of selected master shapes simultaneously. ShapeStudio also provides testing tools to help ensure that behaviors have been implemented as specified, including more than 20 standard shape tests. In addition, ShapeStudio provides the ability to create custom shape tests and save custom test scripts for reuse.

Installation and Setup of ShapeStudio

ShapeStudio is included as part of the Visio 2003 Software Development Kit (SDK), which is available as a free download.

Note   This section only summarizes the installation and setup of ShapeStudio. For more information, see Getting Started Developing Shapes in Visio 2003 ShapeStudio and the ShapeStudio ReadMe in the SDK.

To install ShapeStudio, download the executable file vissdk.exe and run it. (You must already have Visio 2003 installed on your computer before you install the SDK. In addition, you must have access to one of these database applications: Microsoft SQL Server, either on your own computer or on a server; or an instance of Microsoft SQL Server Desktop Engine [MSDE] installed on the same computer that you are using to run ShapeStudio.)

Before you can use ShapeStudio, a database administrator must create the ShapeStudio database that will contain ShapeStudio projects. The ShapeStudio database can be either a SQL Server database located on a server or an MSDE database on a user's local computer. ShapeStudio provides the ShapeStudio Database Administration tool to assist database administrators in this task.

Workflow in ShapeStudio typically consists of the following phases:

  1. Setup and project creation
  2. Specification and design
  3. Development
  4. Validation and testing

The first phase is addressed in more detail in Getting Started Developing Shapes in Visio 2003 ShapeStudio. The remainder of this article leads you through the other three phases of shape creation in ShapeStudio.

Major Steps in Shape Creation

The following list shows the major steps to develop shapes in ShapeStudio:

  • Create a project
  • Create a base master specification
  • Add shape geometry to the base master
  • Assign behaviors to the base master specification
  • Apply base master behavior and validate the base master specification
  • Create master specifications based on the base master specification
  • Define styles to apply to masters
  • Add shape geometry to masters
  • Assign behaviors to masters
  • Apply master behaviors and validate master specifications
  • Create and apply sets of behaviors to masters
  • Run developer and test tools on masters
  • Create and validate stencil specifications and build stencil files
  • Create reports

Description of Example Shapes

In this article, we create three flowchart master shapes, all based on the same base master shape. Each shape changes its shape depending on the selection made by the user from the context menu.

Users can change the appearance of each of these shapes when the flowchart step that it represents has been completed, adding a notch to the shape and thus visually indicating how far the process has progressed. This type of shape is called a multi-state shape. In our case, each shape has two states—incomplete and complete.

The three shapes are similar in appearance and function to the Process, Data, and Decision shapes from the Visio Basic Flowchart Shapes stencil.

Figure 1 shows both states of the finished shapes.

Two user-selectable states for each shape (Click here to see larger image)

Figure 1. Two user-selectable states for each shape (Click picture to view larger image)

In addition, each shape has behaviors and styles assigned to it and shares certain custom properties with the other shapes.

Create a Project

The first step is to create a project in ShapeStudio. A project is the basic organizational structure in ShapeStudio. Projects help you keep your work organized and make collaboration, shape modification, and testing and validation easier.

We are creating a project here because if you haven't used ShapeStudio before, you probably haven't already created one. Of course, you can open an existing project, either one that you created previously or one that another member of your team created. (See the note in the following procedure regarding global projects.)

No firm rule dictates when to open a new project—the decision depends on how you and your team like to work. But it would be appropriate, for example, to keep the shapes and stencils associated with a particular client in a project separate from those associated with another client.

To create a project

  1. On the ShapeStudio menu in Visio 2003, point to Project, and then click New.
  2. In the New Project dialog box, type Flowchart in the Project name box.
  3. In the Data source list, select the data source you want to use.
    Note   We are assuming that you (or your database administrator) have already set up a global project and have set the appropriate permissions in SQL Server so that you have access to a ShapeStudio database. If that is not the case, see the section "Setting Up ShapeStudio" in the companion article to this article, Getting Started Developing Shapes in Visio 2003 ShapeStudio, to learn how to set up the ShapeStudio database and a global project.
  4. In the Visio version box, select the version of Visio that you are using.
  5. In the Project units list, select US units for the project measurement units, and then click OK.

ShapeStudio opens the Flowchart project and a new Visio drawing, which it names with the project name, followed by a hyphen and then the data source name: Flowchart-<data source name>.vsd. The project name appears at the top of the tree in Masters view in the Project Explorer window, as shown in Figure 2.

Figure 2. A tree view, shown in the Project Explorer window, of all the objects in your project

Any base masters and masters that your database administrator has created in the global project also appear in this window. In ShapeStudio, a base master is a prototype shape from which you can derive one or more related shapes, called masters. Masters inherit behaviors from the base masters from which they are derived. Global base masters are base masters created in the global project by the database administrator.

In the example shown in Figure 2, global base masters named Global Base Master I and Global Base Master II and global masters named Global Master I and Global Master II appear. We don't use these global masters in our project, but you may find global masters useful in other projects you create.

Create a Base Master

Next, we add a new base master to our project. The base master that we add is the template for all the flowchart master shapes that we create. We can assign to the base master all the behaviors that we want all the masters derived from the base master to share. We can distinguish the individual masters derived from the base master from one another by assigning to them differing geometries and different sets of additional behaviors.

To add a base master to the project

  1. In the drop-down list in the Project Explorer window, select Masters (if not already selected).
  2. Right-click the Flowchart project in the Project Explorer window, and then click New Base Master.
  3. In the Name box of the New Base Master dialog box, type Flowchart Shapes.
  4. In the Design notes box, type the following: This is the template for all the flowchart shapes we will create.
  5. Click OK.

Note that the new base master that appears in the Project Explorer window has a check-marked icon, indicating that it is checked out of the database. (See Figure 3.) To avoid conflict, no one else can modify the base master if someone already has it checked out.

Figure 3. Icons of checked-out masters display a check mark

Also, note that the new base master appears in the Document Stencil window. (See Figure 4.) Because we have not assigned geometry to the base master, its icon has a generic appearance.

Figure 4. The Document Stencil window

Add Shape Geometry to the Base Master

Shape geometry consists of the lines, angles, and formatting that together define the appearance of a shape. Base masters are never instanced as shapes and are never assigned to stencils—those characteristics apply only to masters derived from base masters. Therefore, you might think it unnecessary to assign geometry to a base master—and, strictly speaking, it is.

However, if we want to apply the behaviors we assign to the base master and validate the base master specification, we must add shape geometry to the base master. If we attempt to apply and validate behaviors assigned to a base master (or a master, for that matter) that has no geometry, ShapeStudio reports a validation error. Applying and validating the behaviors we apply to the base master saves us work later, because we don't need to apply and validate those behaviors individually for each shape we derive from the base master. (However, as you will see, because we add additional behaviors to the masters in our example, we need to apply those behaviors and validate the masters.)

To create geometry for the Flowchart Shapes base master, we open the master in the master-editing window. We add only basic geometry, a plain rectangle, because an instance of the base master itself will never exist and therefore its appearance doesn't concern us. Later we will add appropriate specific geometries to each of the individual masters derived from the base master.

To add shape geometry to the base master

  1. In the Document Stencil window, right-click the Flowchart Shapes master, point to Edit Master, and then click Edit Master Shape. The master-editing window opens, displaying a blank drawing page.
    Tip   Alternatively, you can double-click the base master icon in the Document Stencil window to open the master-editing window.
  2. Click the Rectangle tool and use the tool to draw a small rectangle on the drawing page. The exact size and shape of the rectangle doesn't matter.
  3. Close the master-editing window, and click Yes in the message box to update the base master.

Assign Behaviors to the Base Master

After you create a base master, assign it any behaviors that you want all masters derived from it to share. For example, we want each of our finished shapes to have a single connection point on each side. So for our Flowchart Shapes base master, we assign it behaviors that we want to be common to all Flowchart masters derived from it. Those behaviors become part of the base master specification and, in turn, part of the master specification of each of the masters that inherit from it. We assign the behaviors listed in Table 1 to the Flowchart Shapes base master.

Table 1. Behaviors to assign to the Flowchart Shapes base master

Behavior Value
Connection Points Four Centered Sides
Primary Text Label - Normal - Bottom
Pin Position and Rotation Center-Center - 0 deg - Locked

To assign behaviors to the Flowchart Shapes base master specification

  1. In the Project Explorer window, select the Flowchart Shapes base master specification, if it is not already selected.
  2. In the Specification window, click Modify.
  3. In the Modify Base Master Specification dialog box, click in the Include column for the Connection Points behavior to include that behavior in the specification.

    In this case, we want to accept the default behavior value, Four Centered Sides, so opening the Connection Points Behavior dialog box is not necessary.

  4. Click Include for the Primary Text behavior, click in the Base Master Value column to display a button, and then click the button to open the Primary Text Behavior dialog box.
  5. In the Text block type list, select Label.
  6. Click OK to accept the default values for the rest of the dialog box controls.
  7. Click Include for the Pin Position and Rotation behavior, click in the Base Master Value column to display a button, and then click the button to open the Pin Position and Rotation Behavior dialog box.
  8. Clear Allow shape rotation, and then click OK to accept the default values for the rest of the dialog box controls.
  9. Click OK to close the Modify Base Master Specification dialog box.

Apply Base Master Behaviors and Validate the Base Master Specification

By applying base master behaviors and validating the base master specification now, we can ensure that we have not introduced any errors before we proceed to create masters derived from the base master.

To apply behaviors to a base master specification

  1. In the Project Explorer window, select the Flowchart Shapes master specification.
  2. In the Specification window, click Apply.
Note   It makes no difference which behavior is selected in the Specification window.

To validate a base master specification

In the Specification window, click Validate.

Note   If, when you attempt to validate a specification, ShapeStudio finds errors in the way the specification was implemented, the validation will fail. If that happens, double-click the error message in the Validation window to open the Resolve Errors dialog box and follow the instructions shown. For more information about validation and resolving errors, see ShapeStudio Help.

Create Masters Based on the Base Master

Now we can create our new masters, each of which is a special case of the more generic Flowchart Shapes base master. For each of our three flowchart shape types, we need to create two shapes—one for each state of the shape (incomplete or complete).

To add masters based on a base master to the project

  1. In the drop-down list in the Project Explorer window, select Masters.
  2. Right-click the Flowchart Shapes base master in the Project Explorer window, and then click New Master to open the New Master dialog box.
  3. In the Name box, type Process for the name of the new master.
  4. In the Design notes box, type This shape represents a process in a flowchart. The user can change its appearance to indicate that the process is complete and then click OK.
  5. Repeat steps 1 through 4 for the Data and Decision shapes, in both cases substituting the appropriate name in the New Master dialog box and modifying the design notes accordingly.

Note that the new masters now appear in the tree view in the Project Explorer window under the base master from which they are derived, Flowchart Shapes. (See Figure 5.) Note as well that they display the red check-marked icon indicating that they are checked out and that, as a result, they also appear in the Document Stencil window.

Figure 5. Checked-out masters as they appear in the Project Explorer and Document Stencil windows

Select one of the newly created masters in the Project Explorer window and note that the name of the selected master now appears next to the Master name label at the top of the Specification window, and that all of the behaviors that were applied to the base master have been inherited by the master.

Define Styles

A style is a Visio feature that makes it easier to apply the same formatting to multiple shapes. Although ShapeStudio does not provide a user interface specifically for designing styles, it does track styles in your document, store them in the database, and manage them as part of the checking out and checking in of masters.

We could apply formatting individually to each of the masters that we create, but because they all will be formatted the same way, we should define a style once and then apply that style each time we define the geometry of a master that we want to share that style. In the case of our example, all of the flowchart shapes share the same two styles, one for each state.

All of our shapes are red in the incomplete state and green in the complete state. So our style will include the color of the shape's fill. That property is really all we need to make the two states easily distinguishable, but we might as well throw in another couple of formatting attributes to further illustrate how valuable a tool styles can be.

To define the "incomplete" style

  1. Click the Rectangle tool and draw a rectangle on the drawing page.
  2. Select the shape, and then on the Format menu, click Define Styles.
  3. In the Define Styles dialog box, type incomplete in the Name box to name the style.
  4. Click Fill to open the Fill dialog box.
  5. In the Color list, select red (02), and then click OK.
  6. Click Text to open the Text dialog box.
  7. In the Style list, select Italic, and then click OK.
  8. Click Line to open the Line dialog box.
  9. In the Pattern list, select the dashed line (02), and then click OK.
  10. In the Define Styles dialog box, click Apply to create the style.

Note that the rectangle you used to create the style is now red and displays a dashed perimeter. Double-click the shape and type a few letters to see that the text is italic. You can delete the rectangle, or reselect it and use it for the next procedure.

To define the "complete" style

  1. Click the Rectangle tool and draw a rectangle on the drawing page (or use the rectangle from the previous procedure).
  2. Select the shape, and then on the Format menu, click Define Styles.
  3. In the Define Styles dialog box, type complete in the Name box to name the style.
  4. In the Based on list, select incomplete, and then click Add.
  5. Click Fill to open the Fill dialog box.
  6. In the Color list, select green (03), and then click OK.
  7. Click Text to open the Text dialog box.
  8. In the Style list, select Bold, and then click OK.
  9. Click Line to open the Line dialog box.
  10. On the Pattern list, select the solid line (01).
  11. In the Weight list, select a heavier line weight (05), and then click OK.
  12. In the Define Styles dialog box, click Apply to create the style.

Note that the rectangle you used to create the style is now green and displays a heavy, solid perimeter. Double-click the shape and type a few letters to verify that the text is bold.

We completed creating the two styles that we need, and you can delete the rectangle if you want.

Add Shape Geometry to the Masters

Before we can actually create an instance of a master shape, we must add shape geometry to the master. Shape geometry consists of the lines, angles, and formatting that together define the appearance of a shape.

Let's add shape geometry to the Process master. To do so, we open the master in the master-editing window and draw both states of the shape, complete and incomplete.

To add shape geometry to a master

  1. In the Document Stencil window, right-click the Process master, point to Edit Master, and then click Edit Master Shape. The master-editing window opens, displaying a blank drawing page.
    Tip   Alternatively, you can double-click the master in the Document Stencil window to open the master-editing window.
  2. Click the Rectangle tool and use the tool to draw the outline of the shape on the drawing page. Draw a rectangle that is one and one half units wide and one unit high.
  3. Double-click the shape and type Complete Process.
  4. Select the shape, and on the View menu, point to Toolbars, and click Format Shape.
  5. On the Format Shape toolbar, in the Line Style list, select complete.
  6. Click Yes in the message box to apply all of the formatting associated with the style.

We completed creating shape geometry for one state of the shape. Now we can create the geometry for the other state.

To create a second state for a multi-state shape

  1. Use the Rectangle tool to draw a square one-quarter unit on each side, and then click the Pointer tool and drag the square so that it covers the upper right corner of the rectangle you drew previously.
    Note   If you have trouble drawing the small square, use the Zoom command on the View menu to increase the magnification.
  2. Select the rectangle, press CTRL, and then select the square.
  3. On the Shape menu, point to Operations, and then click Subtract to create a notch in the rectangle.
  4. Click the Rectangle tool and draw another rectangle the same size and shape as the previous rectangle.
  5. Repeat steps 3, 5, and 6 (and step 4, if you need to re-display the Format Shape toolbar) from the previous procedure on the new rectangle, this time adding the text Incomplete Process and applying the incomplete style.
  6. Move the first rectangle so that it completely covers the second.
  7. Press CTRL+A and then CTRL+G to first select and then group the two shapes.
  8. If the Master Explorer window is not already displayed, on the View menu, click Master Explorer Window.
  9. Completely expand the Masters node, including both of the Shapes nodes under it.
  10. Under the final Shapes node, two shapes are identified, Sheet.5 and Sheet.7. Make a note of their names and which shape each name is associated with.
    Tip   If you are not sure which shape is associated with each name, in the Master Explorer window, right-click the shape named Sheet.5, click Show ShapeSheet, and then scroll down in the ShapeSheet window to the Fill Format section. Note that the FillForegnd cell has the value 2, which corresponds to the color red, indicating that shape Sheet.5 is the red rectangle (the incomplete process shape). Or simply select each shape in turn in the Master Explorer window and note the style with which the shape is associated on the Format Shape toolbar.
  11. Close the master-editing window and click Yes to update the Process master geometry.

Assign a Behavior to the Master

We have created geometry for the two states that the Process shape will exhibit, so we can add the MultiState behavior to the Process master. To do so, we need to modify the master specification for the Process master, which, as you remember, already has several behaviors specified—the behaviors inherited from the Flowchart Shapes base master.

To assign a behavior to a master

  1. In the Project Explorer window, select the Process master specification, which should be already checked out. (If not, check it out.)
  2. In the Specification window, click Modify.
  3. In the Modify Master Specification dialog box, select Include for the MultiState behavior.
  4. Click in the Master Value column in the MultiState behavior row, and then click the button to open the MultiState Behavior dialog box.
  5. Click Add to open the Add State dialog box, and in the State name box, type Incomplete.
  6. Without closing the dialog box, click Add again, and then type Complete for the other state name.
  7. Select Toggle menus, and then click OK.
  8. Click OK in the message box (we will run the MultiState tool in the next procedure), and then click OK again to close the Modify Master Specification dialog box.

    Note that the value in the Master Value cell for the MultiState behavior is now Custom.

We have named the two states that the Process shape will exhibit, but we have yet to connect those states to the shape geometries we created. To do so and thereby complete the application of the MultiState behavior, we need to run the MultiState tool.

One detail to note: By selecting Toggle menus in step 7, we specified that only one state—the state currently not visible—appears on the context menu for the shape. For example, if the shape is in the Complete state, Incomplete appears on the menu, and vice versa. To specify that both states always appear on the menu, with the currently visible state indicated by a check mark, clear Toggle menus.

To use the MultiState tool to assign master shape geometries to different states

  1. On the ShapeStudio menu, point to Tools, point to Developer Tools, and then click MultiState.
  2. In the first tool screen, click Next to indicate that you want to implement the behavior for the Process shape.
  3. Click Next to implement both states.
  4. In the All States screen, deselect both states and click Next.
  5. In the screen for the Incomplete state, select Sheet.6! Sheet.5! Geometry1, and then click Next.
  6. In the screen for the Complete state, select Sheet.6! Sheet.7! Geometry1, and then click Next.
  7. Click Finish to close the tool.

Apply Behaviors and Validate the Master Specification

Before we experiment with an instance of the master we created, we need to apply the behaviors we have assigned to the master and to validate the master to ensure that the behaviors we applied match those that were specified.

To apply behaviors to a master specification

  1. In the Project Explorer window, select the Process master specification.
  2. In the Specification window, click Apply.
Note   It makes no difference which behavior is selected in the Specification window.

To validate a master specification

In the Specification window, click Validate.

Note   If, when you attempt to validate a specification, ShapeStudio finds errors in the way the specification was implemented, the validation fails. If that happens, double-click the error message in the Validation window to open the Resolve Errors dialog box and follow the instructions shown. For more information about validation and resolving errors, see ShapeStudio Help.

Now we can see the results of implementing the MultiState behavior by experimenting with an instance of the master shape. Drag the Process master from the Document Stencil window to the drawing page to create the instance.

Right-click the shape and select Complete on the context menu. The shape changes to the Complete state and now appears as a green, notched shape.

We can also see the effects of the other behaviors the shape has inherited from the Flowchart Shapes base master. For example, if you try to rotate the shape, you discover that the rotation handle is unavailable, and hence you cannot rotate the shape. This occurs because we applied the Locked rotation behavior to the base master.

Create More Masters

Starting with the section Add Shape Geometry to the Masters, follow the same procedures to create geometry for the other two masters that are based on the Flowchart Shapes base master, the Data and Decision masters, using the appropriate shape names as displayed in the Master Explorer window.

The following procedures show one way to create the geometry for each of these shapes. Refer to Figure 1 at the beginning of this article to see how the finished shapes should appear.

To create geometry for the Data master

  1. Click the Drawing Tool and draw a rectangle one and one half drawing-page units wide by one drawing-page unit high.
  2. Hold the mouse pointer over the shape until the shape's vertices appear. (The vertices are indicated by small green diamonds on the shape's perimeter.)
  3. Drag both the lower left corner vertex and the lower right corner vertex one-half unit to the left.

To create geometry for the Decision master

  1. On the File menu, point to Shapes, point to Block Diagram, and then click Basic Shapes (US Units).
  2. Drag the Triangle shape from the Basic Shapes stencil onto the drawing page.
  3. Right-click the triangle and click Copy.
  4. Right-click the drawing page and click Paste.
  5. With the second triangle selected, press CTRL+J to flip the shape vertically.
  6. Move the flipped triangle so that its base aligns with that of the first triangle.
  7. Press CTRL and click the first triangle so that both shapes are selected.
  8. On the Shape menu, point to Operations and then click Union.
  9. Resize the shape so that its horizontal axis is one and one half drawing-page units and its vertical axis is one drawing-page unit.

Create a Set of Behaviors

If you drag one of the Flowchart shapes that Visio supplies as part of its Flowchart solution onto the drawing page and then right-click it and choose Properties, you see that the shape has a set of custom properties: Cost, Duration, and Resources. The user can enter values for any or all of these properties to customize an instance of the shape in the drawing. In fact, all of the supplied Flowchart shapes share these same custom properties.

Let's see how we can duplicate this set of custom properties for our Flowchart shapes in ShapeStudio, and how we can create a Custom Property set to apply them all at once to any new masters that we create. We need to define the custom properties themselves in the Visio ShapeSheet spreadsheet.

The general procedure is as follows:

  1. Create a set
  2. Define the behaviors that characterize the set in the ShapeSheet
  3. Assign the set to one or more masters
  4. Apply the behaviors to the masters
  5. Validate the master specification

To create a Custom Property set

  1. In the drop-down list in the Project Explorer window, select Masters.
  2. In the Project Explorer window, expand the Sets node, right-click Custom Property Sets, and then click New Set.
  3. In the New Custom Property Set dialog box, type Flowchart set, and then click OK.

Visio displays an editing window containing one shape to represent the set, the text of which reads, "Define set by adding custom properties to this shape. Please use named rows." If you close this editing window, you see that the new set appears in the tree view in the Project Explorer window under Custom Property Sets, with its icon indicating that it is checked out. An icon for the set appears in the Document Stencil window, as shown in Figure 6.

Figure 6. The icon for a Custom Property set

If you closed the editing window, you need to start at step 1 in the next procedure. If not, start with step 2.

To define a Custom Property set

  1. Double-click the icon for the Flowchart set in the Document Stencil window to open the editing window.
  2. Right-click the set's shape in the editing window, and click Show ShapeSheet.
    Note   To see the Show ShapeSheet command, you must be running Visio in developer mode. To switch to developer mode, on the Tools menu click Options, click Advanced, select Run in developer mode, and click OK.
  3. Right-click anywhere in the ShapeSheet window and click Insert Section.
  4. In the Insert Section dialog box, select Custom properties, and then click OK.
  5. In the Custom Properties section of the ShapeSheet, double-click the Custom Properties cell, type Cost (to name the row), and press Enter.
  6. Press Tab to select the Label cell, and then type Cost to define the label that will appear for the custom property in the Custom Properties dialog box.
  7. Press Tab to select the Prompt cell, and then press Delete. The value of the cell changes to No Formula.
  8. Double-click the Type cell, and then select 7-visPropTypeCurrency from the drop-down list.

    This action specifies the Currency data type for the custom property value.

  9. Press Tab to select the Format cell, and type the symbol @ to specify the Currency format picture for the custom property value.
  10. Press Tab to select the Value cell, and then press Delete. The value of the cell changes to No Formula.
  11. Tab through the rest of the row, changing all the values to No Formula except for the LangID value, which should remain set to 1033. (If your document is not in English, set LangID to the language ID value for the language you want.)
  12. Right-click anywhere in the Custom Properties section and click Insert Row to add a new row to the section. Then add a third row.
  13. In the rows you added, use the techniques in the previous steps to modify the cells to have the values shown in Figure 7.

    ShapeSheet Custom Properties section (Click here to see larger image)

    Figure 7. ShapeSheet Custom Properties section (Click picture to view larger image)

  14. Close the ShapeSheet window and the editing window, and click Yes to update the set definition.

Finally, now that we have created and defined the set, we can assign the set to the Flowchart masters we already created. We could do this in a couple of ways—one way would be to assign the set individually to each of the Flowchart masters we created. But assigning the set to the Flowchart Shapes base master is easier. By so doing, we can assign the set to all of the masters that are derived from the base master in one stroke.

To assign the set to an existing base master specification

  1. In Project Explorer, right-click the Flowchart Shapes base master and select Modify Specification.
  2. In the Modify Master Specification dialog box, in the Include column select Custom Properties.
  3. In the Custom Properties row, click in the Base Master Value column and then click the button to display the Custom Properties Behavior dialog box.
  4. Select Flowchart set, and then click the Details button to display the Custom Property Set Details dialog box.
  5. Examine the set details to ensure that the values are what you expect, and then click OK.
    Note   The Apply and validate value cell data check box is selected by default, but it has no effect for this set because we assigned no formula to the Value cell. For more information, see ShapeStudio Help.
  6. In the Custom Properties Behavior dialog box, select Add properties right-mouse menu command to specify that the Properties command appears on the context menu for masters that have this behavior.
  7. Click OK, and note that Flowchart set now appears in the Base Master Value cell for this behavior.
  8. Click OK to close the Modify Master Specification dialog box.

To apply the behavior set and validate the base master specification

  1. In the Project Explorer window, select the Flowchart Shapes base master.
  2. In the Specification window, click Apply.
  3. In the Specification window, click Validate.

To prove that the behavior set we assigned to the Flowchart Shapes base master is now assigned to all masters derived from it, drag the Process master from the document stencil onto the drawing page. Right-click the instance of the master and click Properties to display the Custom Properties dialog box. Note that the custom properties we assigned to the base master are all present.

Note   By default, behaviors you assign to base masters are automatically assigned to masters derived from those base masters. You can change the default setting in the Options dialog box, which you can access from the ShapeStudio menu.

Use Developer Tools to Modify Masters

ShapeStudio provides two tools that developers can use to make a single change to a ShapeSheet cell value or formula across multiple masters, either in response to a bug, or to implement a specification: the Find and Replace Cells tool, and the Set Cells tool.

The Find and Replace Cells tool allows a developer to make changes to the ShapeSheet of selected masters by searching for a specific result (value) or formula to find, and then specifying the corresponding value or formula to replace it with.

The Set Cells tool allows a developer to change the contents of a particular cell in selected masters, or in all the masters in selected stencils.

To demonstrate the use of these tools, we will first use the Find and Replace Cells tool to find the ShapeSheet cell that contains the name of the Cost custom property and change its value to Price. Then we will note the name of the cell that contains the value we changed and use that cell name in the Set Cells tool to restore the original value.

To find and replace the contents of a ShapeSheet cell in one or more masters

  1. In the Project Explorer window, if they are not already checked out, check out the Process and Data masters (right-click the master and then click Check Out), and then select both masters.
  2. On the ShapeStudio menu, point to Tools, point to Developer Tools, and then click Find and Replace.
  3. In the Find what box in the Find and Replace Cells dialog box, type Cost.
  4. In the Replace with box, type Price.
  5. Select Change values.
  6. Accept the default Match whole string to tell ShapeStudio to search for and replace the entire contents of the cell (instead of any occurrence of the search text, anywhere in the cell).
  7. Click OK to search for the cell value and display the Find and Replace dialog box.
  8. In the Find and Replace dialog box, note that the name of the cell to be changed is Prop.Cost.Label, and then click OK to change the cell in both masters.

If an instance of the Process or Data master is not already on the drawing page, drag the icon of one of those masters from the document stencil to the drawing page. Then right-click the shape instance and click Properties. In the Custom Properties dialog box, note that the name of the first custom property has been changed to Price.

Next we use the Set Cells tool to change the custom property name back to its original value. The cell name that we noted in the previous procedure identifies the cell whose value we need to change.

To change a ShapeSheet cell in one or more masters

  1. In Masters view in the Project Explorer window, select the Process and Data masters. If they are not already checked out, check them out. (Right-click the master and then click Check Out.)
  2. On the ShapeStudio menu, point to Tools, point to Developer Tools, and then click Set Cells.
  3. To specify the cell to set by name, select Cell name, and then type Prop.Cost.Label in the Name box.
  4. In the Replace with box, type Cost.
  5. Select Change values, and then click OK to open another dialog box displaying the proposed changes.
  6. Click OK again to set the cells.

If you right-click an instance of the Process or Data master on the drawing page and click Properties, you see that the original name of the custom property, Cost, has been restored.

Use Test Tools to Test Masters

ShapeStudio provides two test tools that can help determine whether masters meet specifications and help locate bugs that might be causing masters to fail validation: the Standard Shape Tests tool and the Custom Shape Tests tool.

The Standard Shape Tests tool provides 28 pre-defined tests that check various settings for masters. These include, for example, tests to determine whether a shape is on a layer, whether a shape's subshapes are selectable, and whether the text-font point sizes for all subshapes in the master are consistent. For a complete list of tests, see the topic "About Tools in ShapeStudio" in ShapeStudio Help.

You can run all of these tests or any combination of them. Generally, these tests check whether ShapeSheet cells or Automation properties are set properly, according to how the master was specified. Standard tests are read-only: they check settings but do not change them. As we have seen, you can use the Find and Replace Cells and Set Cells tools to change properties in multiple masters.

The Custom Shape Tests tool lets you create custom test scripts that can run one or more custom tests that you design. You can run the script either on selected master specifications in Masters view of the Project Explorer window, or on selected stencil specifications in Stencils view. When you test stencils, you test all of the masters assigned to those stencils. You can save the test scripts you create (as XML files) so that you can run them again and modify them if necessary.

We will use these tools to run some simple tests on the masters we have created, just to get a feel for their user interfaces and to see how they work.

First, let's run the Standard Shape Tests tool. We will run the Help ID Exists test, which tests whether the master has been assigned a Help ID, and which is a test that we know our master will fail, because we haven't assigned a Help ID to the master. Running this test shows us how failing results are reported.

To run a standard test on a master

  1. In the Project Explorer window, click Masters.
  2. Select the Process master.
  3. On the ShapeStudio menu, point to Tools, point to Test Tools, and then click Standard Shape Tests.
  4. Click Deselect All, and then select Help ID Exists.
  5. Click Run to run the selected test and view the test report.

ShapeStudio displays the results of the test in the Output window, as shown in Figure 8.

Test results displayed in the Output window (Click here to see larger image)

Figure 8. Test results displayed in the Output window (Click picture to view larger image)

We see that ShapeStudio displays the name of the master, the type of test being run, the shape instance, and the results of the test, including the name of the cell whose value does not match the specified value.

To determine a cell setting not among those the standard tests are designed to test, we need to create and run a custom test script. Let's test our master to ensure that it has been assigned the language ID for English, 1033. That value is set in the LangID cell of the ShapeSheet.

To create and run a custom test script

  1. In the Project Explorer window, select the Process master.
  2. On the ShapeStudio menu, point to Tools, point to Test Tools, and then click Custom Shape Tests.
  3. Click New to open a new test script file.
  4. To add a custom test to the script, click Add to open the Add Test dialog box.
  5. In the Test name box, type Language ID, and then in the Name box, type LangID.
  6. In the Operator list, select Value Equal,
  7. Type 1033 in the Value box to test for English.
  8. Add a description of the test if you want to do so, and then click OK.
  9. In the Custom Shape Tests dialog box, select the Language ID test, and then click Run.
  10. Click Yes if you want to save the script in the location of your choice so that you can run it again another time.

ShapeStudio displays the test results in the Output window. If the test succeeds, only the path of the test script file and the name of the master are displayed.

Create a Stencil Specification and Assign Masters

To make the shapes you create more readily available to your users and to make the shapes easier to reuse yourself, you should add the shapes to a stencil. Stencils, which are Visio documents that have the file name extension .vss (or .vsx), are easily distributed and stored, and all experienced Visio users are familiar with them.

To add shapes to a stencil in ShapeStudio, follow this basic procedure:

  1. Create a stencil specification
  2. Assign masters to the stencil
  3. Build the stencil
  4. Test and validate the stencil

We will follow these steps to create a Flowchart stencil.

To create a stencil specification

  1. In the drop-down list box in the Project Explorer window, select Stencils.
  2. Right-click the project and then click New Stencil Specification.
  3. In the Name box on the General tab of the Modify Stencil Specification dialog box, type Flowchart. In Design notes, type New flowchart shapes.
  4. Click the Assigned Masters tab and then click Assign Masters.
  5. In the Assign Masters dialog box, add the Process, Decision, and Data masters to the Assigned masters list, and then click OK.
  6. In the New Stencil Specification dialog box, click OK again.

The new stencil appears in Stencils view in the Project Explorer window. Click the plus sign next to Flowchart to expand the stencil node and display the names of the masters it contains, as shown in Figure 9.

Figure 9. Stencils and the masters they contain displayed in Stencil view in the Project Explorer window

Note   You can also assign masters later by right-clicking the stencil specification in the Project Explorer window and then clicking Assign Masters.

Assign Properties to the Stencil File

We assign properties to the stencil file to identify and categorize the stencil. In a big company, for example, it might be useful to be able to search for stencils associated with a certain project or manager. Stencil properties (technically, stencil behaviors) would make such a search easier.

To assign properties to the stencil file

  1. In the Project Explorer window, right-click the Flowchart stencil and click Modify Specification.
  2. In the Category behavior row, select Include, and then type Flowchart stencils for Value.
  3. In the Company behavior row, select Include, and then type the name of your company (or Microsoft) for Value.
  4. Assign as many additional properties as you want, and then click OK.

Build the Stencil File

Now that we have created the stencil, the next step is to build the stencil file.

To build a stencil file

  1. In the Project Explorer window list box, select Stencils.
  2. Right-click the Flowchart stencil and then click Build Stencil.
  3. To change the folder where the stencil will be saved, enter a new location in the Stencil folder box, or click Browse.
    Note   By default, stencil (.vss or .vsx) files are saved to the location in the Stencil folder box. To specify the default location, on the ShapeStudio menu click Options, and enter a file path in the Output stencils box.
  4. Click OK to accept the default stencil file type (.vss), open the stencil immediately after you build it, and build the Flowchart stencil.

The Flowchart stencil opens in the Shapes pane to the left of the drawing page, displaying icons for all the masters you assigned to it.

Validate the Stencil

Now let's validate the stencil to ensure that it was implemented according to the stencil specification.

To validate the stencil specification

  1. In the drop-down list in the Project Explorer window, select Stencils.
  2. In the Project Explorer window, right-click the stencil specification and then click Validate.
  3. In the Validate Stencil dialog box, verify that stencil exists at the path shown. If it does not, either build the stencil or, if the path shown is incorrect, click Browse to locate the correct stencil.
  4. Click OK, and then examine the results in the Validation window.

Create a Project Report

Finally, let's create a report to document the current status of the project. ShapeStudio offers four types of reports: project, master, stencil, and check-out. Project reports provide the following information:

  • Project name
  • Visio version targeted
  • Whether the project is global
  • Names of stencils in the project
  • Masters dependent on global base masters (for global projects only)
  • Stencils that contain global masters (for global projects only)

By default, reports are named Project name_Report type, and reports are saved to the My Documents folder. You can change those settings in the Reports dialog box. By default, reports are saved as .html files, but you can also save them as .xml files. Either way, a report opens in a browser window.

For more information about the other report types, see the topic "About Reports in ShapeStudio" in ShapeStudio Help.

To create a project report

  1. On the ShapeStudio menu, click Reports.
  2. In the Report list, select Project.
  3. In the File name box, specify the location where you want to save the report and the file type (HTM or XML), or click Browse.
  4. To open the report as soon as it is created, select View report now.
  5. Click Run.

Conclusion

In this article, you learned how to use ShapeStudio to create base master and master shape specifications, assign behaviors to those specifications, apply and validate those behaviors, create and assign sets of behaviors, use tools to modify shapes, and conduct tests on the shapes you created. You also learned how to create stencil specifications, assign stencil properties, build stencils, and create ShapeStudio reports. But we addressed only the basics of what you can do with ShapeStudio. By experimenting on your own, you can learn much more about what you can accomplish with ShapeStudio and how effective a shape-creation tool it can be.

Additional Resources

For more information about ShapeStudio, the following resources are available:

  • Getting Started Developing Shapes in Visio 2003 ShapeStudio

    This companion article provides an introduction to ShapeStudio. It describes the ShapeStudio work environment, the workflow process, and various key concepts associated with the tool, and it tells you how to download, install, and set up ShapeStudio.

  • Microsoft Office Visio 2003 SDK (online version)
  • Microsoft Office Visio 2003 SDK (download version)

    The download version of the Visio 2003 software development kit includes ShapeStudio and is available at no charge. ShapeStudio has a built-in Help system that provides conceptual and procedural information about all aspects of ShapeStudio.

Show:
© 2014 Microsoft. All rights reserved.