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

Shape Script Overview

Using Shape Scripts you can define a model image for elements and connectors.




See also


Shape Scripts contain a number of sections for defining different aspects of the image produced; for an element these include:

Main object
Decoration (for example, a Document element might contain an icon depicting a document)


For a connector these include:

Main object
Shape Source
Shape Target


Shape Scripts work on the basis that a default pattern is maintained unless a script contains an alternative definition

If you have a Shape Script with just a decoration, this decoration is added on top of the normally-drawn object
If you have an empty shape routine, it overrides the default; so, a blank 'shape label' prevents the creation of the floating text label for elements that have them

Scripting is NOT case-sensitive: 'Shape' is the same as 'shape'.



Block Layout: Element Example

Below is a simple block example of a script for an element:

shape main


   // draw the object



shape label


     // draw a floating text label



decoration <identifier>


      // draw a 16x16 decoration inside the object




The <identifier> string is an alphanumeric word.



Block Layout: Connector Example

For a connector the example is:

shape main


      // draw the line



shape target


      // draw the shape at the target end



shape source


      // draw the shape at the source end



label <positionLabel>


      // define the text for the label



The <positionLabel> string can be any of:



Order of declaration

Shapes can consist of Attribute declarations, Command calls and Sub Shape definitions, which must appear in that order; that is, Attribute declarations must appear before all Command calls and Sub Shape definitions must appear last.


Shape Attributes


Sub Shapes

A shape can have Sub Shapes.

Sub Shapes must be declared after the main Shape Script, but called from the Method commands.

The following is an example of the ordering for declarations:


shape main


 //Initialisation Attributes - these must be before drawing commands

 noshadow = "true";

 h_align = "center";


 //drawing commands (Methods)


 println("foo bar");


 // call the sub-shape

 addsubshape("red",   20,  70);


 // definition of a sub-shape

 shape red


         setfillcolor(200, 50, 100);





//definition of a label

shape label



 println("Object: #NAME#");




//definition of a Decoration

decoration triangle



 // Draw a triangle for the decoration














Drawing Methods

Learn more