Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: eric.meredith on April 13, 2018, 07:41:29 am
-
Appreciate any help I can get.
I have used the Excel Importer extensively to import Server Objects, Applications, and to create multi-level packages - so I'm familiar with the API interface.
I need to automate the insertion (later update) of Capabilities. Some of these will be decomposed into sub-Capabilities. From a UI perspective I can do everything I want/need, but with automation, I'm not even sure how to ask the right questions.
Yet, "Capabilities within Capabilities" leaves me blank. See this link for an example: https://drive.google.com/file/d/18Fyq6lBsjgLyNaKcl7Ef12oFcuqLNuRV/view?usp=sharing (https://drive.google.com/file/d/18Fyq6lBsjgLyNaKcl7Ef12oFcuqLNuRV/view?usp=sharing)
tldr; What API do I use to add a Capability within an existing Capability.
Thx,
Eric
-
tldr; What API do I use to add a Capability within an existing Capability.
If I understand your question right, you may need two things
1. Get the GUID of your current capability (Use the Excel Exporter to get that) and try to synchronize in subsequent imports
2. Set the ParentID of Element (child capability) to create Capabilities within an existing Capability (Get the Parent Element by using GetElementByGUID)
-
I would recommend that you try creating a simple VB.Net program using Visual Studio Community Edition that reads the spreadsheet directly through the Excel API and then updates the EA model directly using the EA API. In this way, you can bypass the whole problem of Excel importing. You can just write a loop that goes down the rows and/or columns of the spreadsheet and plugs the elements and connectors into EA. I do this all the time and have done some quite complex importing that way.
-
Nizam - thanks, I will try - haven't used the ParentID thingy before.
Rich - I am not using an "Excel Import" per se - I am using VBA (effectively VB) to programmatically create and manipulate objects. I just didn't know how to create a child of a Capability.
Thanks to both for your replies.
Eric
-
You can just create elements in elements by using
newElement = Element.Elements.AddNew("name", "yourmetatypeorstereotype")
q.