Add Shape Scripts

To add a Shape Script to a stereotype in a UML Profile, follow the steps below:

  1. On the Profile Package child diagram, select a Stereotype element.
  2. Right-click on the element and select the Attributes context menu option.
  3. In the Attributes Properties dialog, in the Name field, type _image.
  4. Click on the [ ... ] button next to the Initial field. The Shape Editor dialog displays.
  5. Enter the Shape Script in the Shape Editor dialog, and click on the OK and Close buttons.

The Stereotype element now resembles the example below:



If you are creating a Shape Script for an Association Class, be aware that the Shape Script is applied to both the Class part and the Association part. Therefore, you might have to include logic in the shape main that tests the type of the element so that you can give separate drawing instructions for Class and for Association. Such logic is not necessary in the:

  • shape source or shape target, which are ignored by Classes, or the
  • decoration shapes which are ignored by Associations.