Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

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.



Configure > Reference Data > UML Types > Stereotypes

Shape Script Process



See also


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


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


Type or copy the script into the Edit window.

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

Writing Scripts


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


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.


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


  • 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
  • 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 that the standard mechanism for extending the syntax of UML is 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