Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Mike Chapman on September 23, 2010, 01:47:33 am

Title: Saving a Diagram as an image
Post by: Mike Chapman on September 23, 2010, 01:47:33 am
Greetings from a novice EA automation hacker.  I would like to programmatically create an image that represents a given Diagram.  Exporting it to a file would be just fine.

I see the functionality that I want in the Diagram->Save Image menu item, but I don't see it in the automation interface.  Did I miss something?

If the functionality I desire is not available to me directly, then is there a way to invoke menu functionality through an automation interface?  I saw suggestions of throwing Windows events at the application, or faking key events, in another thread.  Trouble is, this would not just be a simple menu invoke, but interaction with a dialog afterward... and that would make it more ugly and brittle, I would think.  Maybe not even feasible, I'm not sure.
Title: Re: Saving a Diagram as an image
Post by: beginner on September 23, 2010, 03:48:14 am
Try ProjectInterface.Project.SaveDiagramImageToFile (string Filename)


b.
Title: Re: Saving a Diagram as an image
Post by: Mike Chapman on September 28, 2010, 01:14:18 am
Aha, I was not looking at the Project interface, thank you!

I don't want to depend on what the 'current diagram' is, so I will use the PutDiagramImageToFile(guid, filename, type) method so I can specify the guid of the diagram that I want to export.

Again, thanks for pointing me at the right interface.