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.
Settings > Reference Data > UML Types > Stereotypes
Shape Script Process
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.
In the 'Override Appearance' panel, select the 'Shape Script' radio button and then click on the .
The Shape Editor displays.
Type or copy the script into the Edit window.
To review the shape in the 'Preview' panel, click on the .
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 to page through the components of the shape, in the 'Preview' panel.
Once you have finished writing your Shape Script, click on the to return to the 'Stereotypes' tab.
Then click on the to save the Shape Script and its assignment to the stereotype.
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 .
The object's shape now reflects the Shape Script assigned to the stereotype.
- 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