Prev Next

Getting Started With Shape Scripts

As Shape Scripts are associated with stereotypes, you define them through the 'Stereotypes' tab of the 'UML Types' dialog; each stereotype can have one Shape Script. The process of setting up a Shape Script is quite simple yet very flexible.

Access

Ribbon

Configure > Reference Data > UML Types > Stereotypes

Shape Script Process

Step

Action

See also

1

Select the stereotype to which to attach the Shape Script, from the list on the right of the dialog.

You select an existing stereotype, but if a suitable one is not available you can create a new stereotype that, once saved, displays in the list and can be selected.

Custom Stereotypes

2

In the 'Override Appearance' panel, select the 'Shape Script' radio button and then click on the Assign button.

The Shape Editor displays.

Shape Script Editor

3

Type or copy the script into the Edit window.

To review the shape in the 'Preview' panel, click on the Refresh button.

Writing Scripts

4

If you define a composite Shape Script (a main shape with decorations and labels, or separate parts such as a connector with source-end and target-end shapes), click on the Next Shape button to page through the components of the shape, in the 'Preview' panel.

Example Scripts

5

Once you have finished writing your Shape Script, click on the OK button to return to the 'Stereotypes' tab.

Then click on the Save button to save the Shape Script and its assignment to the stereotype.

6

Drag and drop the appropriate standard UML element or connector into your diagram. The object will be of the type you selected as the 'Base Class' of the stereotype.

Right-click on the object and select the 'Properties' option.

On the 'Properties' dialog, click on the 'Stereotype' drop-down arrow, select the stereotype you created and click on the OK button.

The object's shape now reflects the Shape Script assigned to the stereotype.

Custom Stereotypes

Notes

  • Using a Shape Script to modify an element's appearance makes some of the normal 'Appearance' context menu options redundant for that element, so they will be disabled
  • It is not possible to modify or override Shape Scripts for types that are defined in an MDG Technology
  • Font selection is not supported in Shape Scripts because the best user experience is achieved by allowing the user to set fonts themselves
  • UML defines the standard mechanism for extending the syntax of UML to be through Profiles; for this reason Shape Scripts can not be applied to any element independently of a stereotype
  • Shape Scripts cannot be used for connectors that use the Bezier line style
  • Shape Scripts do not currently support:
         -  Looping constructs
         -  String Manipulation
         -  Arithmetical Operations
         -  Variable declaration