Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Rudi Claes on March 01, 2011, 03:54:29 am
-
I'm writing a script in order to color some elements on a diagram based on the presence / contents of a tagged value. Rather straightforward stuff, but the coloring is giving me some trouble. More specifically the third parameter of SetAppearance: a call to SetAppearance 1,0,255 followed by an Update gives a nice red color and 1,0,-1 returns the default color, but what of the other basic colors (yellow, blue, green, etc)? Is this documented somewhere?
-
Select element
Press F4
Uncheck default color
-> the RGB values are the ones you need
q.
-
Not that I know off, however if you can live with a stereotype it is very easy to change an elements appearance via tagged values using shapescripts.
Not sure if this of any help, but maybe worth a look
Cheers
Phil
-
I have not tried this, but I would probably looking into such as feature sometime soon.. There is a method part of Element,, Hope it helps,,,
SetAppearance (long Scope, long Item, long Value)
Void
Sets the visual appearance of the element.
Parameter:
Scope: Long - Scope of appearance set to modify
0 – Local (Diagram-local appearance)
1 – Base (Default appearance across entire model)
Item: Long - Appearance item to modify
0 – Background color
1 – Font Color
2 – Border Color
3 – Border Width
Value: Long - Value to set appearance to.
-
Value: Long - Value to set appearance to.
in VBScript
Clng(255) for red
tried passing a RGB representation of the color CLng(255-0-0)
both works
-
tried passing a RGB representation of the color CLng(255-0-0)
I suspect the only reason that works is because it evaluates to 255 minus zero minus zero = 255. For an RGB representation, use red + green x 100hex + blue x 10000hex.
-
Found using the diagram legend -> Apply auto color, works just fine so don't use a script anymore as its a lot faster on the larger diagrams.