Author Topic: Run the "Diagrams Only" report from the automation interface?  (Read 1315 times)

Bjorn S

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Run the "Diagrams Only" report from the automation interface?
« on: December 22, 2016, 09:00:23 pm »
I am using Sparx EA 13 build 1309.

I can run the HTML Report by doing EA.Repository->GetProjectInterface()->RunHTMLReport(...). Ditto for the pure RTF report, doing ...->RunReport(...). How would I go about getting the the "Diagrams Only Report" so I can generate the diagrams as PNG-files?

I suppose I can loop through the whole model and call a ...->GetProjectInterface()->PutDiagramImageToFile(...) for each diagram I find, but it certainly would be more convenient to just use the existing functionality.

The root problem here is of course that RunHTMLReport() doesn't generate image file names that are persistent across invocations (i.e. based on their GUIDs) like the "Diagrams Only Report" does. Missing a persistent way to address a diagram, it makes it impossible to refer to them from other documentation (e.g. a wiki).

Suggestions, ideas, ...?

Thanks,

Bjorn

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 115
  • Karma: +0/-1
  • Business Information Architect
    • View Profile
Re: Run the "Diagrams Only" report from the automation interface?
« Reply #1 on: December 28, 2016, 08:20:04 am »
Currently Im extracting diagrams from standard HTML report.
Within that report there is a bunch of files with mappings between EA element eaGuids and EA website filepaths under:
EARoot/ js/data/guidmaps/ GuidMapXX.xml 
, where XX are the first to signs of the eaGuid (following the start curly bracket.  If you are scanning all the GuidMap files you dont need to think about these two characters in the file name but if you want to use it as a look-up, you can exploit that knowledge I just scan all the files and create a hashmap data structure (currently)
Each file contain a set of mappings between eaGuids and their corresponding html pages
Youll need to do some html-scraping on the html page to find the path to the diagram image.
--- as I said, this is the way I currently do it I actually want to change this and instead use the API call PutDiagramImageToFile.  Then I wont have to run the EA HTML report at all.  But there are som issues with that (see my post "PutDiagramImageToFile - varies on margins! What is is the algorithm?" from today: http://sparxsystems.com/forums/smf/index.php/topic,37685.0.html ).
« Last Edit: December 28, 2016, 08:23:54 am by Svend Erik Nygaard »

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6452
  • Karma: +55/-6
    • View Profile
Re: Run the "Diagrams Only" report from the automation interface?
« Reply #2 on: December 28, 2016, 09:12:58 am »
The root problem here is of course that RunHTMLReport() doesn't generate image file names that are persistent across invocations (i.e. based on their GUIDs) like the "Diagrams Only Report" does. Missing a persistent way to address a diagram, it makes it impossible to refer to them from other documentation (e.g. a wiki).

Suggestions, ideas, ...?

http://sparxsystems.com/enterprise_architect_user_guide/13.0/model_publishing/htmlreport.html

Quote
View page for specific diagram or element
When you view the web report in your web browser, you can switch directly to a page for a specific diagram or element by specifying the appropriate GUID after the report web address. That is:
     http://path/path/path/Index.htm?guid=xxxxxxxxxxxx
Type the word guid in lower case, and do not include braces { } in the value; for example:
     http:// .../path/Index.htm?guid=DC62B0DA-0D60-4447-85E6-B9BBAE7FC90F
To obtain the GUID, right-click on the Package or element in the Project Browser and select the 'Copy/Paste' option, or right-click on the diagram and select the 'Copy Reference' option.
Simon

support@sparxsystems.com