Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: novice user on September 01, 2008, 06:34:05 pm

Title: Finding diagram messages from VB
Post by: novice user on September 01, 2008, 06:34:05 pm
I would like to generate a list of all the messages in a diagram, using VBA.
The "Diagram" object does not have a "messages" method.
How can I find all the messages?
(I assume there are 2 methods - going over all the "DiagramObjects" of the diagram and finding which one is a connector, or going all the connectors in the repository and finding which one are connected to the diagram. Any recommendation of code fragments?)
Thanks
Title: Re: Finding diagram messages from VB
Post by: «Midnight» on September 01, 2008, 09:35:38 pm
Use the DiagramLinks collection and interrogate each.

You can also write a custom search and call that from automation.
Title: Re: Finding diagram messages from VB
Post by: novice user on September 01, 2008, 10:13:19 pm
The DiagramLinks of the diagram is empty.
Please note that the documentation claims that "A Diagram link is only created once a user modifies a connector in a diagram in some way. Until this condition has been met default values are used and the diagram link is not in use."
Title: Re: Finding diagram messages from VB
Post by: «Midnight» on September 02, 2008, 01:29:37 am
EA often draws connectors on the fly, so long as all parameters are set to the default values. [I guess that...] Doing it this way it does not require so much database interaction.

Still, there is a link there, or at the very least there is a Link object for each of the DiagramObjects (supplier and client) elements. You can look it up and set up a diagram link, then modify some (any) value. It will be saved. [NB: The diagram link might be saved if you set it up at all. I've not had to do this for a while, and the application I used was making them invisible on selected diagrams.]

HTH, David
Title: Re: Finding diagram messages from VB
Post by: novice user on September 02, 2008, 01:36:20 am
Using the diagram link object might have worked. I might test it.
In the meantime, I implemented something that goes over all the elements in the package, and for each one checks for all the connectors whether they are part of the diagram. Not efficient, but works.
Thanks for the answers.