Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: tweber on March 02, 2024, 12:19:24 am

Title: Changing Default Color of a Connector
Post 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)?
Title: Re: Changing Default Color of a Connector
Post by: qwerty on March 02, 2024, 01:21:35 am
Either you do that in your profile or you can use template definitions.

q.
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 02, 2024, 02:14:26 am
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.
Title: Re: Changing Default Color of a Connector
Post by: Paolo F Cantoni on March 02, 2024, 11:16:41 am
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.
Title: Re: Changing Default Color of a Connector
Post by: qwerty on March 02, 2024, 11:18:37 am
might as well be that your stereortyped connectors have shape script and overwrite any setting.

q.
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 07, 2024, 04:45:15 am
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.
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 07, 2024, 06:02:39 am
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.
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 07, 2024, 07:31:26 am
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. 
Title: Re: Changing Default Color of a Connector
Post by: Geert Bellekens on March 07, 2024, 08:20:06 pm
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
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 08, 2024, 12:30:35 am
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.
Title: Re: Changing Default Color of a Connector
Post by: Geert Bellekens on March 08, 2024, 01:32:12 am
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
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 08, 2024, 02:18:17 am
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.
Title: Re: Changing Default Color of a Connector
Post by: tweber on March 08, 2024, 02:52:56 am
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();
}
   
Title: Re: Changing Default Color of a Connector
Post by: Marc Lampron on March 09, 2024, 06:22:56 am
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.