Book a Demo

Author Topic: Get a collection of diagrams the Model  (Read 5769 times)

tzafrir

  • EA User
  • **
  • Posts: 127
  • Karma: +0/-0
    • View Profile
Get a collection of diagrams the Model
« on: June 22, 2016, 03:19:30 pm »
Hi,
I need to get all the diagrams in my model
I tried to do it by getting all the IDs\Guids of all the diagrams in my model.

I used the repository API (for IDs):
sql = "select Diagram_id from t_diagram";
string result = repository.SQLQuery(sql);
But then I need to parse the resulting string xml.

(GetElementSet API did not help me for that matter as well)

Is there a more efficient way to do it by getting a direct EA.Diagram collection by using EA API?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get a collection of diagrams the Model
« Reply #1 on: June 22, 2016, 03:57:39 pm »
No, but there are load of examples to look at at the Enterprise Architect VBScript Library
The one that I use for general purposes like that is: convertQueryResultToArray(xmlQueryResult) from the XML utility script

Geert

StefanPears

  • EA User
  • **
  • Posts: 119
  • Karma: +6/-0
  • Unwissenheit schützt vor Erkenntnis nicht
    • View Profile
Re: Get a collection of diagrams the Model
« Reply #2 on: June 22, 2016, 05:51:29 pm »
I am not sure if you need an API solution or if you just need a list of diagram names (and other attributes). For the later I suggest rtf document generation. The template is really simple:

package >
diagram >
Diagram {Diagram.Name} in Package {Diagram.ParentPackage}
< diagram
child packages >
< child packages
< package