Book a Demo

Author Topic: Shape script control by external switch  (Read 5389 times)

dstueven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Shape script control by external switch
« on: November 08, 2018, 09:21:23 pm »
Hi all,
I use shape scripts as part of stereotypes to control the layout of my components on a diagram. For example I add a red bubble to the corner of a component based on a tag of the component.
Now I would like to implement a kind of switch for somebody looking at the diagram, to allow him to show these bubbles as part of the diagram or not.
This sounds very much like something which can be done using diagram filters, but they only work on whole components.
An idea would be to react on a diagram filter in the shape script but there is no way to find out if a diagram filter it on or off from a shape script or am I wrong?
Any other idea how I could implement the needed behaviour?
Thanks for your help!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape script control by external switch
« Reply #1 on: November 08, 2018, 09:48:51 pm »
You could use the "rectangular notation" property to distinguish between the formats.

I think the archimate stereotypes all use this to support two different notations.

Geert

dstueven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Shape script control by external switch
« Reply #2 on: November 08, 2018, 10:43:08 pm »
Hi Geert,
thanks for your answer - looks indeed like an option for two types of notation. Unfortunately I have even more - the bubble was just one that I used to explain it. Ideally I would be able to create around 5 different types.
Am I correct that there is no way for a script to access a kind of self configurable central object that I could use?
Dirk

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape script control by external switch
« Reply #3 on: November 08, 2018, 10:58:58 pm »
No, unless you use an add-in call.
With standard Shape script you can only use properties of the element itself.

Using add-in call can easily become a big performance problem, so be careful if choosing that path.

Geert

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Shape script control by external switch
« Reply #4 on: November 09, 2018, 05:34:47 am »
You could use diagram stereotype. In the shape script you can check if the diagram stereotype is set to certain value and show the bubble otherwise if not don't. Eazy peazy aye?
Happy to help
:)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shape script control by external switch
« Reply #5 on: November 09, 2018, 10:54:51 am »
You could use diagram stereotype. In the shape script you can check if the diagram stereotype is set to certain value and show the bubble otherwise if not don't. Eazy peazy aye?
Best practice (It's Friday, so I'll stick my neck out  ;))  Is to use user-selectable properties (Search Help for "user-selectable").

They allow you to vary the rendering of the item via the shape script on a diagram by diagram basis.

We intend to use them to select the "level of richness" of the item rendering.  We've done some experiments and it will work, but the current implementation of the properties and their selection makes it a bit cumbersome.

If there are rules relating the diagram type to the richness of the rendering, then, as Sunshine says, you should use the diagram stereotype.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

dstueven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Shape script control by external switch
« Reply #6 on: November 09, 2018, 09:44:06 pm »
Hi Sunshine & Paolo,
good idea. That sounds like it could do the trick if I create several diagram stereotypes and switch between them. Will give it a try. Thanks.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shape script control by external switch
« Reply #7 on: November 12, 2018, 10:28:00 am »
Hi Sunshine & Paolo,
good idea. That sounds like it could do the trick if I create several diagram stereotypes and switch between them. Will give it a try. Thanks.
Hi Dirk,
If I understand what you're suggesting, I would caution against changing stereotypes "on the fly".  That's not what they're there for.

If you need to change the rendering on the fly, then you should use the user-defined properties - that's what they're there for.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape script control by external switch
« Reply #8 on: November 12, 2018, 11:31:59 am »
If you're wanting to change that notation for all elements on the diagram, I would be creating customized diagram types, then checking diagram.mdgtype within your shape scripts. This means the modeler has the choice of whether the extra notation is shown or not.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Shape script control by external switch
« Reply #9 on: November 12, 2018, 05:56:08 pm »
If you're wanting to change that notation for all elements on the diagram, I would be creating customized diagram types, then checking diagram.mdgtype within your shape scripts. This means the modeler has the choice of whether the extra notation is shown or not.
Yeah thats a good idea too.
Happy to help
:)