Book a Demo

Author Topic: GetImage  (Read 4683 times)

dams

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
GetImage
« on: February 06, 2009, 08:07:01 pm »
Hello,
I don't see an instruction in the Automation Interface to get the image of a diagram, e.g. GetImage. It could be a useful.
An additional instruction to extract only all images in an Images folder, e.g. ExportPackageImages, like you already do for ExportPackageXMI, would be good too.
Thanks!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: GetImage
« Reply #1 on: February 08, 2009, 05:02:35 am »
There is a function to capture a diagram image via the clipboard. From there you can grab it via various Windows API calls. You can also drop a diagram image to a file.

They are both methods of the Project interface. Remember you can get an instance of this interface via Repository.GetProjectInterface method if you don't want to keep the reference around.

Look up PutDiagramImageOnClipboard, PutDiagramImageToFile, and also SaveDiagramImageToFile.

The above said, there is a glaring lack of a means to capture an image via an object in memory. The clipboard is kind of unweildy, and not well suited to 'modern' coding practice. The whole idea of having to write a file and read it back is somewhat ridiculous. I suggest you make a feature request directly to Sparx - use the link near the bottom of any forum page - if you'd like to see this gap filled. I've made the request, but it really will not rate on the priority scale unless others do the same.

HTH, David
No, you can't have it!

dams

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: GetImage
« Reply #2 on: February 09, 2009, 06:24:25 pm »
Thanks for your quick answer David.
I didn't see these methods.
But I am still interested in a method that could be named ExportPackageImages to export all diagram images of a particular package into a folder where looping on each sub-package would be automatically managed. Like ExportPackageXMI but without generating the XML file. The idea to always give each file the same unique name is very good: it enables inserting links in external documents which keep being valid after diagram changes. The choice of EMF image format is also very important: it enables resizing without details loss.
As this post already is in the "Suggestions and Requests" part I hope EA people will hear me!  ;)
Dams

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: GetImage
« Reply #3 on: February 09, 2009, 10:48:54 pm »
I agree Dams,

There are several ways that the existing functionality could be improved, with no restructuring of EA required. You and I have pointed to two needs that could be addressed.

You've taken the first step, which is to post here. Remember that this is a user forum, although the Sparxians are very active here.

If you want to ensure that your suggestion is read and considered - with the understanding that the final decision rests with Sparx - then make a feature request. Use the Feature Request link below the Support link near the bottom of any forum page.

A local best practice we (the forum crowd) have been following is to post here first - this allows for discussion, workarounds, even possible solutions to a problem. When you make the feature request, paste in the URL of the forum thread. That may help the Sparxians should they wish to join into the discussion, or merely assess the level of support expressed by other users.

David
No, you can't have it!

dams

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: GetImage
« Reply #4 on: February 10, 2009, 12:09:57 am »
Ok, you're right.
That's done.
Dams