Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Guillaume on April 30, 2019, 08:13:50 pm

Title: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on April 30, 2019, 08:13:50 pm
Hi,
I need to get the saved image for a diagram provided the option "Auto create Diagram Image" is enabled.
I created a simple script that runs the following query:

select t_document.StrContent from t_document inner join t_diagram on t_document.ElementID = t_diagram.ea_guid where t_document.DocName = 'DIAGRAMIMAGEMAP' and t_diagram.ea_guid = '"& myDiag.DiagramGUID&"'

I tried to decode the resulting content but it doesn't produce a valid image ou zip file. Any idea?

Thanks
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on April 30, 2019, 10:55:52 pm
Uh. Where do I find that option (and in which EA version)?

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on April 30, 2019, 10:59:37 pm
It's available since EA13 I think. In EA14, open menu Configure > (Model) Options, then Cloud > Auto Create.
Once enabled, modify and save a diagram -> it will create an image in the DB

There's an option to run a batch update on all existing diagrams (it can take a while).

Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on April 30, 2019, 11:06:26 pm
I don't have that Cloud option. Sorry then.

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on April 30, 2019, 11:11:02 pm
In EA13.5, it's under Configure > Options > General
Then Data Cache at the bottom of the popup.

Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on April 30, 2019, 11:53:32 pm
Found it. Will have a look...

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on May 01, 2019, 12:00:02 am
That's indeed no zip. And also it's no native BMP, PNG or JPG. I suspect it's some Sparxian alien blob.

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on May 01, 2019, 12:02:20 am
Hopefully the blob can be demystified by its creator  ;)
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on May 01, 2019, 12:04:51 am
I have no idea what they use it for. The best you can do is to create a image via API when you need it (though this needs opening the diagram tab ad dealing with potential diagram changes when it's already open).

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Geert Bellekens on May 01, 2019, 03:11:10 am
Actually the fastest way to export diagramImages is to export a package to xmi (with the option to include the diagram images)
A bonus is that EA doesn't open all those diagrams in the GUI.

Geert
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: qwerty on May 01, 2019, 07:24:17 am
with the option to include the diagram images

That's indeed tricky :-)

q.
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on May 02, 2019, 05:38:42 pm
Thanks for your answers
Howerver I'm looking for a more dynamic option that doesn't use an XMI file.
I'll continue investigating..

Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Nizam on May 02, 2019, 06:24:55 pm
These diagram images can only be accessed through the PCS APIs (AFAIK), and this was primarily introduced for Webtools  Prolaborate, WebEA etc (AFAIK)
Title: Re: Retrieve diagram images and decode the Base64 content
Post by: Guillaume on May 03, 2019, 04:16:47 pm
Thanks for the clarification Nizam.