Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Xuxin on June 17, 2013, 08:16:01 am
-
Hello everyone,
I have created my user interface to collect input data. Then my add-in can analyze the class diagram in EA. Now my question is that how to show the class diagram where the selected class/object is drawn to yellow/red color.
I think I could use EA API to export XMI file. Then I use C# window designer to show the drawn class diagram image.
Is it feasible? Otherwise, could anyone give me any suggestion? Thanks for help. ::)
-
How about Repository.OpenDiagram(id) ?
q.
-
The Repository.OpenDiagram(id) might be useful. But that need my add-in create a new diagram in EA, then open it using its ID.
I found a solution. Use Repository.GetCurrentDiagram() to get the diagram to be drawn. Then call Diagram.DiagramObjects property to get a collection of DiagramObject. Then give the value for DiagramObject.Style property. For example:
BCol=n;BFol=n;LCol=n;LWth=n;
where:
· BCol = Background Color
· BFol = Font Color
· LCol = Line Color
· LWth = Line Width
Using this approach, I suppose that we could draw the specific elements in a class diagram. I will test it later. :D
-
Its still not clear to me what you are trying to achieve.
Please explain in more detail.
Geert
-
Its still not clear to me what you are trying to achieve.
Please explain in more detail.
Geert
You really must have too much spare time :-)
q.
-
Thank you to be interested in my topic.
My project is to draw the class diagram in EA. Then let users enter some input data. My add-in will do some analysis for the diagram using input data. Finally, the add-in output the class diagram with drawing colors to some elements.
I have created my user interface. Now I concentrate on the analysis implementation. After it, I will make the add-in draw the class diagram in EA.
-
Ok, I think I understand.
If you want to create a new class diagram you'll need to add one to the element or package you want to create it under.
You'll need something like Package.Diagrams.AddNew()
Then you need to add elements to your diagram using the DiagramObjects collection, so Diagram.DiagramObjects.AddNew().
Make sure you link the diagramObject to the element in your model you want to show.
Then you can indeed play with the Style field to change color etc..
Regards
Geert
-
Hi Geert,
Thank you to validate this approach. I will use Diagram.DiagramObjects.AddNew() and DiagramObject.Style to draw the diagram.
Regards,
Xuxin