Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: babdev on June 30, 2017, 06:25:37 pm

Title: How to access messages on communication diagrams via scripting
Post by: babdev on June 30, 2017, 06:25:37 pm
Hi

I'm trying to access details of messages on links between objects on communication diagrams through the scripting interface. My assumption is that the messages, and their ordering, are a property of the diagram rather than the relationships between the elements. I was expecting to find a property or collection of properties holding these details on the DiagramLinks class, but can't see one. Wondering if I've misunderstood this and I'm looking in the wrong place.

Any guidance would be greatly appreciated  :)
Title: Re: How to access messages on communication diagrams via scripting
Post by: qwerty on June 30, 2017, 07:40:41 pm
This is EA, you know... In case of messages you find everything in the connector itself: Start/EndPoint, SequenceNo, DiagramID, StateFlags. There is no DiagramLink created. That's also the reason why creating SDs with classes leads to to lost messages (they are created only once per element and if you have only one class instead of many instances you loose data - EAUI).

q.
Title: Re: How to access messages on communication diagrams via scripting
Post by: babdev on June 30, 2017, 11:17:18 pm
This is EA, you know... In case of messages you find everything in the connector itself: Start/EndPoint, SequenceNo, DiagramID, StateFlags. There is no DiagramLink created. That's also the reason why creating SDs with classes leads to to lost messages (they are created only once per element and if you have only one class instead of many instances you loose data - EAUI).

q.

Right, think I understand now. On the communication diagram it looks as if the messages are stored as Connection class instances of type Collaboration.  Not particularly intuitive. Thanks for your help  :)
Title: Re: How to access messages on communication diagrams via scripting
Post by: babdev on July 04, 2017, 01:40:06 am
I'm writing a script to process the contents of a diagram. When I find a DiagramObject of type "UMLDiagram" I want to access the diagram to which it refers, but I can't see how to do it. Any ideas?
Title: Re: How to access messages on communication diagrams via scripting
Post by: qwerty on July 04, 2017, 06:20:51 am
In the according EAElement (t_object) look into MiscData[0] (PDATA1). This holds the DiagramID.

q.
Title: Re: How to access messages on communication diagrams via scripting
Post by: babdev on July 04, 2017, 08:18:44 pm
In the according EAElement (t_object) look into MiscData[0] (PDATA1). This holds the DiagramID.

q.

Still having problems with this. Here's what I'm doing:
Not sure if I've misunderstood where to look for the MiscData.
Title: Re: How to access messages on communication diagrams via scripting
Post by: Geert Bellekens on July 04, 2017, 08:29:59 pm
Miscdata is an array, so you have to get MiscData(0) or something like that.

Geert
Title: Re: How to access messages on communication diagrams via scripting
Post by: babdev on July 04, 2017, 08:42:59 pm
Ok, got it now.

Getting the MiscData(0) property and then using it with GetDiagramByID works.

Thanks both  :)