Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: tweber on March 02, 2024, 12:19:24 am
-
Is there a way to set the default color of a connector (i.e., a stereotyped Dependency, for instance)?
-
Either you do that in your profile or you can use template definitions.
q.
-
I created a 'Templates' package, pointed EA to it via the Settings > Reference Data > Settings > Project Template Package', found my 'Templates' package, selected OK, and then proceeded to set up two classes, with my stereotyped dependencies ('HTTPGet' and 'HTTPPost') with different colors. after saving everything, I went back to my working package, and created a new <HTTPPost> connector, which was the 'default' black color. I have to be doing something wrong.
-
I created a 'Templates' package, pointed EA to it via the Settings > Reference Data > Settings > Project Template Package', found my 'Templates' package, selected OK, and then proceeded to set up two classes, with my stereotyped dependencies ('HTTPGet' and 'HTTPPost') with different colors. after saving everything, I went back to my working package, and created a new <HTTPPost> connector, which was the 'default' black color. I have to be doing something wrong.
I vaguely remember that template packages can only be used for shapes, not connectors[1]. I manage ours via the profile, as q suggested.
HTH,
Paolo
[1] I think this is because connectors can't belong to a package.
-
might as well be that your stereortyped connectors have shape script and overwrite any setting.
q.
-
Does anyone have a list of all of the shapescript methods (i.e., such as 'setlinestyle()', moveto(), etc.)? So far, I've been able to create a shapescript for my stereotyped dependency, but I'm getting frustrated trying to guess the method that sets the line color to green.
-
Never mind, kind of... Found the methods for setting line color and width. That said, I tried this:
shape main {
noshadow = true;
setlinestyle("dash");
setpencolor(0,0,0);
setpenwidth(2);
startpath();
moveto(0,0);
lineto(100,0);
endpath();
}
Sets line to, well, nothing. I see the arrow, but no color, no dashes, etc.
Oh, and I can add that each time I attempt to update the UML type more than once, EA crashes. Again, I have to be doing something wrong here.
-
After many attempts, I got my stereotyped line to show as green.
shape main {
setlinestyle("dash");
setpencolor(0,255,0);
setpenwidth(1);
moveto(0,0);
lineto(100,0);
}
Now, I need to determine how to locate a way to set the arrowhead's characteristics.
-
There's no need to guess; it's all in the manual:
https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/shape_editor_2.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/shape_editor_2.html)
If you are looking for more examples, see https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library)
Geert
-
I've often thought that this information was carefully hidden in the manual. That's why I have asked whether someone had actually cracked the code and would provide me where in that manual the information for changing the characteristics of an arrowhead using the shape script's capabilities exists. I'd really appreciate some help here.
-
The example scripts https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/example_scripts.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/example_scripts.html) where most helpful for me to understand how this works for connectors.
Geert
-
I guess I probably didn't ask my question correctly. I am creating a stereotype for a Dependency connection. All I want to do is change the connector's color. I've accomplished almost all of that. The arrowhead is still the default black color. I'm guessing from your replies that there is no way to recolor it, but rather draw over it. If that's true, then I can do that. I was hoping that there was a way for me to access the characteristics of the arrowhead without redrawing it.
-
For the record, this worked.
shape main {
setlinestyle("dash");
setpencolor(0,255,0);
setpenwidth(1);
moveto(0,0);
lineto(100,0);
}
shape target {
rotatable = true;
setpencolor(0,255,0);
setpenwidth(1);
startpath();
moveto(0,0);
lineto(16,5);
moveto(0,0);
lineto(16,-5);
endpath();
fillandstrokepath();
}
-
Hi,
There is also a low-tech solution to this need and somewhat manual.
You can use the F4 function key to set de default appearance of a connector.
This way, the connector will always have the set color in every diagrams.