Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: niko_ea on June 13, 2024, 06:56:38 pm
-
Dear all,
I am currently developing an Add-In for EA. I read here (https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/customviews.html) that it is possible to implement a custom view in an Add-In.
In my Add-In, I would like to offer an option that displays all elements with a certain tagged value set to 'true' in a custom view. Currently, I have this feature as a Diagram Filter, but I would like to automate it with a script.
However, I cannot figure out how to add a DiagramObject to my UserControl. The reason for this is that I have many diagrams in my project, and rather than adding the same DiagramFilter to every diagram manually, I want to automate the process.
I would greatly appreciate any help or guidance you can provide.
Thank you very much!
Best regards,
Niko
-
What do you mean by adding a diagramObject to your usercontrol?
What exactly do you need to happen?
Geert
-
Basically, what I need is to go through the DiagramObjects, and if the tagged value is set to true, I want to add the object to my custom tab. This way, the user can see the original view of the diagram and an alternative view in a separate tab.
As far as I understand, for the custom view, I need to write my own class that extends UserControl. This class can be added through the Repository.AddTab() function. Therefore, I believe I need to add the DiagramObject somehow to the UserControl so it can be displayed in the custom tab.
-
It sounds like what you're expecting is to have a functioning EA diagram in your custom view.
The closest I think you could get is to make a temporary diagram that your add-in uses, add the objects to that, save the image and then show that image in your control.
https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/the_addnew_function.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/the_addnew_function.html)
https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/project_2.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/project_2.html)
-
Thank you very much for the answer. This should solve my problem. I will try out this approach.
-
Currently, I have this feature as a Diagram Filter, but I would like to automate it with a script.
Would it be an option to have your script add the Diagram Filter to the diagrams you selected for processing?
-
Yes, this would also be an option. I looked into it but couldn't find an API call to add a Diagram Filter to the Diagram automatically. Do you know how to do that?