Book a Demo

Author Topic: Changing Default Color of a Connector  (Read 14157 times)

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Changing Default Color of a Connector
« 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)?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Changing Default Color of a Connector
« Reply #1 on: March 02, 2024, 01:21:35 am »
Either you do that in your profile or you can use template definitions.

q.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #2 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.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Changing Default Color of a Connector
« Reply #3 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.
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Changing Default Color of a Connector
« Reply #4 on: March 02, 2024, 11:18:37 am »
might as well be that your stereortyped connectors have shape script and overwrite any setting.

q.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #5 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.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #6 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.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #7 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. 

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Changing Default Color of a Connector
« Reply #8 on: March 07, 2024, 08:20:06 pm »

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #9 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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Changing Default Color of a Connector
« Reply #10 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 where most helpful for me to understand how this works for connectors.

Geert

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #11 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.

tweber

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #12 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();
}
   

Marc Lampron

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Changing Default Color of a Connector
« Reply #13 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.