Author Topic: Automate "Insert Related Elements" feature  (Read 11582 times)

felixkrull

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Automate "Insert Related Elements" feature
« on: November 27, 2021, 12:10:53 am »
Hi all,
I would like to automatically create diagrams. Why?
Assume I have a large number of model elements (e.g. classes) in my repo and I want to create a diagram for each single model element that shows its related elements.
What I am planning to do:
* Iterate over all model elements
* create a diagram for each model element
* put the model element onto the diagram
* populate all related model elements of that model element in focus onto the diagram as well

In manual operation I would use the "Insert Related Elements..." feature from the diagram object's context menu.

Is there an equivalent in the automation interface? Neither the Diagram class not the DiagramObject class seems to provide such a method, correct?

Any advice appriciated.

Felix

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automate "Insert Related Elements" feature
« Reply #1 on: November 27, 2021, 12:23:53 am »
No, there's isn't anything like that in the API, but I once wrote a script to such a feature that might prove helpful:

https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Projects/EA-Matic%20Scripts/AutoUpdateDiagram.vbs

This script depends on my EA Addin Framework, which can be installed by installing the EA Toolpack: https://github.com/GeertBellekens/Enterprise-Architect-Toolpack/releases/tag/v2.3.15.0

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automate "Insert Related Elements" feature
« Reply #2 on: November 27, 2021, 10:43:40 am »
Paolo once created his so-called neighborhood diagrams which seem to be targeting the same (and I'm going to get something similar for my customer in the near future). No idea if he still thinks about selling that. There still seems to be a market for that.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Automate "Insert Related Elements" feature
« Reply #3 on: November 29, 2021, 11:26:40 am »
Paolo once created his so-called neighborhood diagrams which seem to be targeting the same (and I'm going to get something similar for my customer in the near future). No idea if he still thinks about selling that. There still seems to be a market for that.

q.
Unfortunately, the software is not in a fit state to provide to others.  However, we use it on an almost daily basis to process (often 1000's of) diagrams.  It DOES require a particular approach to the structure of the repository.  I can, if there is interest, provide some description of the process which has evolved over more than a decade.  This may help others (like q) proposing to build something similar.


Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automate "Insert Related Elements" feature
« Reply #4 on: November 29, 2021, 08:39:04 pm »
I think that the most challenging part will be the organizational one. It will be part of the modeling rules and I know by heart that teaching and controlling them is tricky or just often a PITA. Nevertheless, having them installed will clearly improve modeling as a whole.

q.

satrman

  • EA User
  • **
  • Posts: 50
  • Karma: +2/-0
    • View Profile
Re: Automate "Insert Related Elements" feature
« Reply #5 on: December 08, 2021, 08:38:11 am »
In 2008 in my previous company, I assigned this task to our programmers - it was constructed as .Net addin. There was a functional prototype, however there were some bugs to be resolved.
Brief functionalities
- for selected package (branch) store generation options in tagged values (there was also cleanup script to remove those tags)
- generation options were roughly the same as in Insert related elements dialogue + there was a filter to object types which the generation should be applied on
- for each element in branch (that corresponded to the filter) it generated composite diagram whit @prefix in his name (so if you edited any of those manually, you just removed @ and re-generation didn't overwrite it

I have no clue, if it works in EA15, but there would be license issues anyway (the company never sold it to anyone, still it is their property). However, if someone is interested, I can look around, if I can find my old specification and I also think, I could show a demo on teams meeting (if it works with EA15...), so you get the idea.

Even though I know EA data model well (and understand the object model), this task is still beyond my skills - I would prefere to use the new in-model addin feature, but didn't get chance to search for its capabilities - however - I work in banking environment and anythink that needs to be installed on PC is a problem - thus in-model addins seem to be promissing solution...