Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: duncan.greenyer on March 31, 2023, 09:09:43 pm

Title: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on March 31, 2023, 09:09:43 pm
I'm extending Archimate using a profile when I add a shapescript the ArchiMate Actor icon is still being drawn how do I override this?
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: Geert Bellekens on March 31, 2023, 09:46:50 pm
I guess you'll have to redefine the decorations as well in your shapescript. See https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/tree/master/Archimate3 (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/tree/master/Archimate3) for the original Archimate shapescript.

Geert
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on March 31, 2023, 09:55:36 pm
Its strange but redefining the decoration does not seem to prevent the original decoration from being rendered. This means I can still see the original decoration underneath.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: qwerty on April 01, 2023, 07:01:34 am
IIRC, Paolo dealt with a similar issue and he plastered the original icon with some rectangle (though the color at the border won't match exactly due to the gradient of the base color).

q.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: Paolo F Cantoni on April 01, 2023, 04:10:58 pm
IIRC, Paolo dealt with a similar issue, and he plastered the original icon with some rectangle (though the color at the border won't match exactly due to the gradient of the base color).

q.
As q says, we had to turn off gradient fill otherwise, it looked "wrong".  Some might say "gradient fill" is an affectation, and we really haven't missed it.

Paolo
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on April 03, 2023, 05:11:02 pm
The problem is, if you use decoration to add a rectangle over the icon the decoration is 16x16 and the ArchiMate icons are larger and therefore are not completely covered. I have opted to create a new decoration icon with NW orientation so that both are displayed. Since its a specialization of ArchiMate it shouldn't matter butI hope one day we can dump shape script and move to SVG for better control.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: qwerty on April 03, 2023, 05:37:55 pm
I doubt that SVG would be an alternative since you can not script it.

q.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: Paolo F Cantoni on April 04, 2023, 08:02:18 am
The problem is, if you use decoration to add a rectangle over the icon the decoration is 16x16, and the ArchiMate icons are larger and therefore are not completely covered. I have opted to create a new decoration icon with NW orientation so that both are displayed. Since it's a specialization of ArchiMate, it shouldn't matter but I hope one day we can dump the shape script and move to SVG for better control.
Just keep increasing the size until the underlying decoration is covered.  From memory, we've gone as high as 120x115.


Paolo
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on April 04, 2023, 05:25:42 pm
Cannot script SVG? I assume you mean there is not exposed object model in EA? Obviously SVG by its very nature is scriptable. You take the SVG parse it into an object model which then gives you the ability to call methods on those objects, the same way you can script SVG in a browser, just add the script to the SVG event.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: qwerty on April 04, 2023, 06:40:05 pm
Cannot script SVG? I assume you mean there is not exposed object model in EA? Obviously SVG by its very nature is scriptable. You take the SVG parse it into an object model which then gives you the ability to call methods on those objects, the same way you can script SVG in a browser, just add the script to the SVG event.

How would you include "if x then render A else render B" in an XML structure?

q.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on April 04, 2023, 07:23:48 pm
I would use the same technique as in a browser:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
    <script>//<![CDATA[
        …code…
    //]]>
    </script>
</svg>

Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: qwerty on April 04, 2023, 07:42:00 pm
Oh! I was not aware of that. Probably means you have to code some Java-like stuff?

q.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on April 04, 2023, 07:51:55 pm
Well it would be Javascript but the level of control would far exceed ShapeScript as we could not only have If then else but loops etc... or event make other calls when elements are about to be rendered
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: qwerty on April 04, 2023, 09:21:56 pm
Yes, probably. But then you would stumble over the performance issue in quite some cases. Which is why shape script is so primitive. Anyway, unless we all are supplied with enough Q-bits there will likely be no progress in that direction.

q.
Title: Re: New Profile - Override ArchiMate - Shape Script
Post by: duncan.greenyer on April 04, 2023, 10:13:46 pm
I don't think its going to take quantum computing just a better Javascript engine like V8.