Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bachus on December 15, 2014, 11:03:51 pm
-
Hello UML guru out there,
I'm struggling to create my vbs script to go through all the elements of my diagram and the elements of the composite diagrams.
My idea is to applied a scrip on Package as the one in the picture bellow.
The script should check all the elements of all the diagrams.
(http://i58.tinypic.com/6jizrm.png)
I've managed to checks the elements of each diagram independently, but not for the composite diagram
Do you have an idea how to do it ?
Thanks in advance
-
I don't see where the problem is :-?
Can't you find the composite diagram or do you have trouble iterating its elements?
q.
-
Hello,
Sadly I will answer yes at your two question... :-/
In a nutshell, I don't know how to write my script to iterate through all the elements of my package (including composite diagrams).
I tried to iterate the Package element's with
Repository.GetTreeSelectedPackage()
But It wasn't successful.
-
To access the composite diagram you need EAElement.CompositeDiagram
To iterate to the elements in a diagram use EADiagram.DiagramObjects. The returned collection of diagram objects will allow to access the EAElement via Repository.GetElementByID. Note that you will also find Notes, Boundaries and other stuff you might need to ignore.
q.
-
In your example:
pkg.Elements - will return Class1, Component1, Component2
pkg.Diagrams - will return pkg1
To get the child elements and diagrams you need to recursively call
elem.Elements
elem.Diagrams