Author Topic: Generate documentation for one specific diagram  (Read 2036 times)

MatthiasVDE

  • EA User
  • **
  • Posts: 196
  • Karma: +1/-0
    • View Profile
Generate documentation for one specific diagram
« on: July 08, 2022, 07:17:17 pm »
I have a package with multiple diagrams. But I want to generate model documents only for one specific diagram in that package. I trigger the project browser script from one specific diagram, but the model document is always based on the parent package of the diagrams. So when I'm generating my documents, it always contains all the diagrams from that package.

Do I really need to put one diagram per package, or is there any workaround for this?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generate documentation for one specific diagram
« Reply #1 on: July 08, 2022, 11:44:58 pm »
IIR you can add filters to your template to filter the diagram based on the type of diagram or the diagram name.

Geert

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: Generate documentation for one specific diagram
« Reply #2 on: May 22, 2023, 10:00:26 pm »
I've never found an easy way to do this, and Geert's suggestion would make it easy. But I've never found such options.

I document specific diagrams with 'Document Script'.

  • I have a template with a fragment
  • The fragment uses Custom Query -> Document Script
  • Document Script selects and calls a script which contains the logic to document correct diagram

To get you started with the Document Script:
Create a EA.DocumentGenerator: https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/document_generator_interface_class.html
Code: [Select]
Repository.CreateDocumentGenerator();
Create the logic to find the correct diagram, then use 'DocumentDiagram(...)' from the link above.

Generate as RTF:
Code: [Select]
GetDocumentAsRTF();
A limitation with this approach if using SQL search on the Model Document, is that you must search for an element (as far as I know).

So what I do is usually have an guid-based search for element, then find diagram occurences, or child diagrams in the script, with if statements for types names etc to find my diagram of choice.

The Document Script input parameters I usually have main(objectID, diagramName/diagramType/whatever). Sometimes depending on occasion I only have main(objectID), or main(diagramID).

This seems a bit complicated for just documenting a specific diagram. But this is how I do it.

I have Document Scripts for different scenarios:
  • showDiagramOfType
  • showDiagramOfName

Or just have diagrams in seperate packages, but is not always optimal/wanted.
always learning!