Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Sreedhar on May 09, 2015, 10:24:16 pm

Title: Save diagrams as images with program
Post by: Sreedhar on May 09, 2015, 10:24:16 pm
Usually in EA, We do following

- Open the diagram
- Save image as Diagram

1. How can we do this with any program (C#,Java) in EA ?

We use the MySQL repository.

1. Is there any way, we can create a diagram from the diagram/objects stored in tables using any program (C#,Java)?
Title: Re: Save diagrams as images with program
Post by: qwerty on May 11, 2015, 01:28:29 am
1.(a) Yes. You can use ProjectInterface.PutDiagramImageToFile

1.(b) Yes. Use the API to do that.

q.
Title: Re: Save diagrams as images with program
Post by: Sreedhar on May 11, 2015, 01:33:34 am
thank you for the suggestion.

I am looking for offline solution. Like i am going to write java program and get the information from MySQL. Create a diagram.

Did you come across any examples with this requirement ?

Please share the example.
Title: Re: Save diagrams as images with program
Post by: qwerty on May 11, 2015, 03:44:32 am
I have no of-the-shelf example for either. But both are not very difficult at all. Of course I'd recommend to have a look into my Scripting book (link below). If you run into any difficulties you can still ask for help for details.

q.
Title: Re: Save diagrams as images with program
Post by: Knut Jetlund on May 11, 2015, 04:39:39 pm
I have a VBScript for exporting diagrams to image files, here: https://github.com/jetgeo/EA_Dakat2UML/blob/master/Scripts/Export%20diagrams%20as%20images.vbs

It exports three specific diagrams from each package, and with some modifications it may be helpful to you.
Title: Re: Save diagrams as images with program
Post by: VKN on May 11, 2015, 05:27:52 pm
I'm guessing Sreedhar wants to programatically:
Title: Re: Save diagrams as images with program
Post by: Sreedhar on May 11, 2015, 07:09:37 pm
Yes, VKN - you are right.

What ever the solutions so far came across to me are looking for the .eap project. Then, using API the existing diagrams will be exported.

We were thinking to leverage the mysql database storage by having offline solution to pick the diagrams existing in models. that way, we can provide read access to the users only interested in checking final output. than having installation of EA in their system and have a look for models.

Let me give my idea : We are storing the image content as blobs in mysql database columns. Can we extract the blob content and make a image ?
Title: Re: Save diagrams as images with program
Post by: qwerty on May 11, 2015, 07:14:06 pm
Yes and no. The diagrams are rendered on the fly by EA. You *can* store the rendering as blob in the db. But for what use? Better use a HTML export if offline navigability is what you want.

Further: if you want to store blob data in the DB you need to create your own table. That *is* possible but of course not recommended. You may come in conflict with EA (although unlikely) but XMI export/import will simply ignore your tables.

q.
Title: Re: Save diagrams as images with program
Post by: Sreedhar on May 11, 2015, 08:12:17 pm
thank you for the suggestion.

If we want to update the HTML screens with fresh data, We just need to trigger the eap again and again.
Title: Re: Save diagrams as images with program
Post by: qwerty on May 12, 2015, 01:53:26 am
There are a couple of threads here dealing with an automated export of HTML. The difficulty here is that EA can not easily be run as service.

q.