Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: SystemsTinkerer on February 24, 2022, 11:23:26 pm

Title: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: SystemsTinkerer on February 24, 2022, 11:23:26 pm
Hi friends,

hope all is well. I have realised the default IDE, is really terrible for using script languages so can anyone provide some tips on the steps to configure a dedicated programming IDE like visual basic or eclipse so that I can write code to interact with the EA Repository/Model? Any language like C++, C# or Java would do.

Thanks,
Oz
Title: Re: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: Geert Bellekens on February 25, 2022, 12:15:46 am
You can use Visual Studio and write C#

See https://github.com/GeertBellekens/Enterprise-Architect-Toolpack (https://github.com/GeertBellekens/Enterprise-Architect-Toolpack) for examples

Geert
Title: Re: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: qwerty on February 25, 2022, 03:41:50 am
I'm using Python since it has nice debugging and is pretty fast too (unless you're going to rip up some terabyte database ). Using Wingware as IDE.

q.
Title: Re: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: SystemsTinkerer on February 25, 2022, 04:12:32 am
You can use Visual Studio and write C#

See https://github.com/GeertBellekens/Enterprise-Architect-Toolpack (https://github.com/GeertBellekens/Enterprise-Architect-Toolpack) for examples

Geert

Hi Geert & q,

Thank you for your input.

Isn't there a set path configurations to be made before I can do any coding to communicate with EA? For instance,  I came across somewhere, a recommendation to include the path of EA.tbl file I am not sure where to do that in visual studio.

Also, Geert, is there a very simple example in C#/C++ that can be used just to get started. The default examples that come with EA library run to many lines of code...

Thanks again,
Oz
Title: Re: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: Geert Bellekens on February 25, 2022, 04:56:10 am
In order to use the API in a C# project you need to reference the EA.interop.dll (found in the program files folder)

You can connect to the currently running EA instance using

Code: [Select]
            object obj = Marshal.GetActiveObject("EA.App");
            var eaApp = obj as global::EA.App;
            var repository = App.Repository;

You then have a hold of the Repository object, where it all starts. See https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/repository3.html (https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/repository3.html)

Geert
Title: Re: Configuring Visual Studio/Eclipse for EA scripting in Java/C++
Post by: SystemsTinkerer on February 26, 2022, 05:05:11 am
Geert - many thanks for clarifying this further. :)

Best,
Oz