Book a Demo

Author Topic: How to access messages on communication diagrams via scripting  (Read 6788 times)

babdev

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
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  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #1 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.

babdev

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #2 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  :)

babdev

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #3 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?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #4 on: July 04, 2017, 06:20:51 am »
In the according EAElement (t_object) look into MiscData[0] (PDATA1). This holds the DiagramID.

q.

babdev

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #5 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:
  • I have created a communication diagram and added some objects and links / messages between them
  • I have created a second communication diagram and dragged the original diagram onto it from the project browser. There are no other objects on this second diagram.
  • I run a script against the second diagram and iterate over the diagram objects. There's one diagram object of objectType 19.
  • I get the Element using the object's ElementID; the Element has Type UMLDiagram. This is all pretty much as expected, however I can't see how to get to the original diagram from this Element. This Element has an ObjectType of 4 and the MiscData property in the Locals window when debugging is set to "Parameter not optional".
Not sure if I've misunderstood where to look for the MiscData.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13495
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to access messages on communication diagrams via scripting
« Reply #6 on: July 04, 2017, 08:29:59 pm »
Miscdata is an array, so you have to get MiscData(0) or something like that.

Geert

babdev

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: How to access messages on communication diagrams via scripting
« Reply #7 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  :)