Book a Demo

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

Prev Next

Add Shape Scripts

UML elements and connectors each have a standard appearance, in terms of shape, color and labeling. It is possible to change the appearance of a type of element or connector in a number of ways, using a Shape Script to define the exact feature you want to impose on the default - or main - shape. If you want to standardize the appearance, to apply to many elements, you attach the Shape Script to an attribute of a Stereotype element in a UML Profile (such as an MDG Technology UML Profile).

Access

For the element that defines the stereotype within your UML Profile, define an attribute named '_image' that will specify the Shape Script.

Display the Shape Script editor by clicking the browse icon in the 'Initial Value' field of the '_image' attribute.

Ribbon

Design > Element > Features > Attributes > [define or select the attribute '_image'] > click on Browse. in the 'Initial Value' field.

Context Menu

Right-click on Stereotype element | Features | Attributes | <define or select the attribute '_image'> | click on Browse. in the 'Initial Value' field

Keyboard Shortcuts

F9 | <define or select the attribute '_image'>] | click on Browse. in the 'Initial Value' field

Add a Shape Script to a Stereotype element

The Stereotype element now resembles this example:

A UML Profile diagram in Sparx Systems Enterprise Architect showing a stereotype being defined with a shape script in the _image attribute.

Step

Description

See also

1

In the 'Name' field, type '_image'.

2

Click on the Browse. button next to the 'Initial Value' field.

The 'Shape Editor' dialog displays.

Shape Editor

3

Enter the Shape Script in the 'Shape Editor' dialog.

When you have finished writing the Shape Script, click on the OK button and then the Close button.

Write Scripts

Notes

  • Your Shape Script might include externally-defined images; in this case the Shape Script would include the image method, specifying the image file name prefixed with the technology name
  • If you are creating a Shape Script for an Association Class, note 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
  • You can also apply Shape Scripts to elements on an ad hoc basis, attaching the Shape Script to a stereotype defined on the 'UML Types' dialog ('Settings > Reference Data > UML Types')

Learn more