Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bachus on December 15, 2014, 11:03:51 pm

Title: VBS Script to go through all composite diag elt
Post 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
Title: Re: VBS Script to go through all composite diag el
Post by: qwerty on December 16, 2014, 12:08:11 am
I don't see where the problem is :-?

Can't you find the composite diagram or do you have trouble iterating its elements?

q.
Title: Re: VBS Script to go through all composite diag el
Post by: bachus on December 16, 2014, 12:29:46 am
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
Code: [Select]
Repository.GetTreeSelectedPackage()
But It wasn't successful.
Title: Re: VBS Script to go through all composite diag el
Post by: qwerty on December 16, 2014, 04:52:41 am
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.
Title: Re: VBS Script to go through all composite diag el
Post by: Eve on December 16, 2014, 05:01:12 pm
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