Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Mithal on November 02, 2010, 08:04:06 pm

Title: Adding TextElement to diagram
Post by: Mithal on November 02, 2010, 08:04:06 pm
Hi how can i get all the diagrams when a project is opened.  I can add a textelement to a diagram, so i wan to be abble to add textelement to all the diagrams for existing projects.

Currently i can add i a textelement to a a new diagram.

I tried using the EA_OnPostOpenDiagram but this event does not fire.

First prize would be to get all the diagras when the project is opened.

Thanks :)
Title: Re: Adding TextElement to diagram
Post by: Geert Bellekens on November 03, 2010, 05:31:47 pm
Mithal,

I would try the event EA_FileOpen.
That will fire when a model is opened.
If you then need all the diagrams in that model I would use
Repository.SQLQuery to get a list of all diagram ID's and then use Repository.GetDiagramByID to get each diagram.

Depending on the number of diagrams in your model this might take a while.

Geert
Title: Re: Adding TextElement to diagram
Post by: Mithal on November 11, 2010, 09:58:14 pm
Cool thanks, will c if this improves the performance.

I am Currently using Repository.GetTreeXML(0) which takes while.

and then eg.
newDiagram = (EA.Diagram)Repository.GetDiagramByGuid("{D6C1A865-52C9-44dc-AC04-9F933F76EFE0}");