Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: gandel on February 19, 2014, 03:54:42 am

Title: Reload diagram without re-routing connections
Post by: gandel on February 19, 2014, 03:54:42 am
Hi,
I changed direction of connection on open diagram with my script, but the change is not visible.
I tried some methods to make it visible:
Code: [Select]
selectedConnector.Update();
currentDiagram.Update();
Repository.ReloadDiagram(long DiagramID)
it works, but in addition re-routes some of other connections, so I have to manually repair them.
I tried also:
Code: [Select]
selectedConnector.Update();
currentDiagram.Update();
Repository.RefreshOpenDiagrams(true)
and it does nothing.
Now I do:
Code: [Select]
selectedConnector.Update();
currentDiagram.Update();
Repository.CloseDiagram(currentDiagram.DiagramID);
Repository.OpenDiagram(currentDiagram.DiagramID);
and it works, but scrolls my diagram to the top left corner.

Is there any better method to make the change of direction visible?
Title: Re: Reload diagram without re-routing connections
Post by: qwerty on February 19, 2014, 04:18:36 am
What means "change direction"? Change the type to be Target -> Source or did you exchange Supplier and Client?

q.
Title: Re: Reload diagram without re-routing connections
Post by: gandel on February 19, 2014, 05:02:01 am
To change direction means to change value of connector attribute "Direction".
Title: Re: Reload diagram without re-routing connections
Post by: qwerty on February 19, 2014, 07:50:36 am
Ok. First you do not need to call diagram.update as you change only a connector. If you issue reloadDiagram it will eventually discard changes. So you should call SaveDiagram first.

q.
Title: Re: Reload diagram without re-routing connections
Post by: gandel on February 19, 2014, 08:04:16 pm
Thanks, now it works, no other connections re-routes!
Now it is like this:
Code: [Select]
selectedConnector.Direction = "Bi-Directional";
selectedConnector.Update();
Repository.SaveDiagram(currentDiagram.DiagramID);
Repository.ReloadDiagram(currentDiagram.DiagramID);