Enterprise Architect Automation Add Ins

I’ve started looking at Enterprise Architect Automation because I need to figure out how to automate a process model driven generation (MDG) process that involves a number of manual steps.

EA does provide some capabilities which sound promising.

It has a built in scripting engine which lets you build scripts in VBScript, JScript or JavaScript and place this into context  of a selected package, element, search very easily. You are able to easily query the repository model, add elements, change styling  and perform actions such as saving diagrams, opening models and others.

While this initially looked promising, its actually quite restrictive. There is no way to run and external program or make a web request from within the scripting engine.  Effectively you are locked into IO with the EA application.

A better option appears to be the creation of a EA Addin.  There was a nice tutorial on this here about how to create an addin in C#.  This was easy enough to do.  Within the C# library you have access to the same entities as the scripting language but of course you have complete flexibility in the library to make use of any libraries that you want to perform IO.

I was interested to create an addin which directly creates a Json Schema from a diagrams Object instances.

I found that in C# one can use the NewtonSoft.Json libraries to create JObject and JProperty instances and then serialize to Json using JsonConvert.SerializeObject.

As I was intending to serialize Object instances with Runstate, I found that RunState is only available as a string that needs to be parsed from a weird


format. Arggh.

The development life cycle is also problematic as each change requires a restart of EA for the new dll to be loaded.






3 thoughts on “Enterprise Architect Automation Add Ins

  1. Hi,

    Nice article!
    You might find however that the scripting far less restrictive then you think.
    As long as you us the correct .Net libraries you can do almost anything, including reading and writing files to the file system. To make things a bit easier I wrote some VBScript wrapper classes for file access and things like that. See https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Utils/TextFile.vbs for an example class from my Enterprise Architect VBScript library. You can find some more context about this project here: http://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/

    But then again, it is still scripting. So if you have to opportunity to develop an add-in I would certainly choose that path.

    And yes you are right, the EA API is very limited and absolutely ugly. It is not much more then a very thin shell on top of the database. That is also the reason why I wrote a nice and clean (or at least cleaner) wrapper library: https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework
    More info on how to use the library can be found here: http://bellekens.com/2014/05/27/how-to-use-the-enterprise-architect-add-in-framework/



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s