Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: sig550 on February 16, 2017, 01:03:47 am

Title: set the order of connectors in a sequence diagram
Post by: sig550 on February 16, 2017, 01:03:47 am
Hey,

I'm trying to create an addin in VS C# which automatically creates a sequence diagram. I can add elements and I can add connectors from element a to element b, but the order of the connectors goes wrong. Example:

I set the relations as followed:
1) A ---> B
2)            B ---> C
3) A ----------> C

But 2) and 3) swapped to the following result:
1) A ---> B
3) A ----------> C
2)            B ---> C

It looks like he prints all connectors from element a first, then all from element b and so on. Is there a way to set the order of the connectors like added?
Title: Re: set the order of connectors in a sequence diagram
Post by: qwerty on February 16, 2017, 02:46:28 am
It seems like this is controlled by Connector.EndPointY. I have not tried that, but this corresponds to the order in the diagram. There's also Connector.StateFlags which seem to play a role.

q.
Title: Re: set the order of connectors in a sequence diagram
Post by: Geert Bellekens on February 16, 2017, 03:22:47 am
For sequence diagram messages you have to set the Sequence Number (t_connector.SeqNo in the database)

Geert
Title: Re: set the order of connectors in a sequence diagram
Post by: sig550 on February 16, 2017, 03:48:52 am
Could you give me a short example how to work with the database in EA? There should be something to get access to the DB. Like a connector or a database object.

sig550
Title: Re: set the order of connectors in a sequence diagram
Post by: qwerty on February 16, 2017, 06:46:55 am
Use the SQL Search scratch pad for only queries. Repository.SQLQuery(query) returns a XML result set. And (shameless plug) look into my Inside book.

q.
Title: Re: set the order of connectors in a sequence diagram
Post by: Geert Bellekens on February 16, 2017, 06:22:21 pm
You don't need to access the database for this one. You can use EA.Connector.SequenceNo

Geert
Title: Re: set the order of connectors in a sequence diagram
Post by: sig550 on February 16, 2017, 07:50:38 pm
Thank you very much, works perfect.