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.
Topics
Topic |
Description |
See also |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Abstract |
Shape Scripts contain a number of sections for defining different aspects of the image produced; for an element these include:
For a connector these include:
Shape Scripts work on the basis that a default pattern is maintained unless a script contains an alternative definition
|
|
||||||||||||||||||
Block Layout: Element Example |
Below is a simple block example of a script for an element: { // 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: { // 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.
|
|||||||||||||||||||
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) rectangle(0,0,100,100); println("foo bar");
// call the sub-shape addsubshape("red", 20, 70);
// definition of a sub-shape shape red { setfillcolor(200, 50, 100); rectangle(50,50,100,100); } }
//definition of a label shape label { setOrigin("SW",0,0); println("Object: #NAME#"); }
//definition of a Decoration decoration triangle {
// Draw a triangle for the decoration startpath(); moveto(0,30); lineto(50,100); lineto(100,0);
endpath(); setfillcolor(153,204,255); fillandstrokepath();
}
|
Learn more