Book a Demo

Author Topic: Shape Script, native shape, and something simple like fill color  (Read 5475 times)

i4mdone

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Shape Script, native shape, and something simple like fill color
« on: November 10, 2019, 02:56:04 am »
Based on a tagged value, I would like to change the color of the "native" shape - meaning I don't want to recreate the shape (through shape script) just to get it looking like the native shape only to change the fill color.  Any ideas?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #1 on: November 10, 2019, 03:00:50 am »
shape main {
  SetFillColor(r,g,b);
  SetPen(r,g,b);
  DrawNativeShape();
}

q.

i4mdone

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #2 on: November 10, 2019, 06:36:44 am »
Thanks that worked perfectly.  Now only if there is a way to reflect that in a "Custom Style" diagram...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #3 on: November 10, 2019, 09:10:10 am »
"Custom Style"  means?

q.

i4mdone

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #4 on: November 11, 2019, 01:49:31 am »
v15 has a "new" feature to alter the appearance of a diagram by selecting the "Custom Style" checkbox that makes things appear a bit more visually appealing yet maintain semantic integrity.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #5 on: November 11, 2019, 03:11:17 am »
Good luck with EA's new features. I'll stay with V13(.5).

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #6 on: November 11, 2019, 03:36:14 am »
Thanks that worked perfectly.  Now only if there is a way to reflect that in a "Custom Style" diagram...
After a quick look through the documentation, I don't think there is. It looks like Custom Styles are a separate beast from shape scripts.

Elements in shape scripts have a number of attributes you can test to control what gets drawn. One of these is RectangleNotation, which reflects whether the user has selected rectangle notation for the element (mainly actors and use cases). This is old functionality, but kinda similar to these custom styles.

In addition, there are a number of properties relating to the diagram which you can also check in a shape script, including Diagram.HandDrawn and Diagram.ConnectorNotation. These are also old and also kinda similar to custom styles.

What all this leads up to is that if the custom styles were integrated into the shape script functionality, I would have expected to find similar attributes, but related to custom styles, in the shape script documentation and I haven't been able to.

So my guess is that custom styles override shape scripts. But that is a guess.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #7 on: November 11, 2019, 10:29:15 am »
From what I understand having played around with it a little bit.
Shape scripts can be overridden at the diagram level or at the element level. So you can have a diagram with all elements displayed using their shape scripts , or all elements displayed without their shape scripts or something in between. So it's actually quite clever and flexible.

Thanks,Rupert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape Script, native shape, and something simple like fill color
« Reply #8 on: November 12, 2019, 10:54:51 am »
So my guess is that custom styles override shape scripts. But that is a guess.
Confirmed. Custom styles completely prevent the shape script from running. That is intentional, the behavior should be the same for both UML and profiled types.

Consider using a diagram legend with 'Apply auto color'.

https://sparxsystems.com/enterprise_architect_user_guide/15.0/modeling/add_a_legend.html