Book a Demo

Author Topic: Creating model elements from outside EA  (Read 3380 times)

Doubter

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Creating model elements from outside EA
« on: February 09, 2023, 02:36:42 am »
Hello!

I am working with a SysML model and I want to create a few things in the model from outside EA. It's mostly Values that I want to create for already existing blocks in the model. The Values should be connected to a ValueType and have a Default Value.

Now I'm thinking about, what is the best way to this. As I already work a lot with a XML-Export of said SysML model, I was thinking about editing and adding the values in the XML file and import it afterwards. The other option I was wondering about is if EA has a programming interface that can import data and create model elements.

Does someone maybe have already done something like that or can help me getting started with this?
I'd love to hear all the advice and feedback I can get as I didn't really manage to find anything yet on how to facilitate this.

Thank you!
Thomas

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13497
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating model elements from outside EA
« Reply #1 on: February 09, 2023, 03:22:16 am »
Hi Thomas,

Yes, EA has an API that you can use to do almost anything, including importing things.
The documentation for the API starts here: https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/theautomationinterface.html

If you are looking for other examples than the ones in the documentation, you can have a loot at my github repo's
https://github.com/GeertBellekens/Enterprise-Architect-Toolpack
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Creating model elements from outside EA
« Reply #2 on: February 09, 2023, 05:58:22 am »
You probably want to look into EAAttribute.Default to set the default values. It's a collection of an element's attributes retrievable via EAElement.Attributes.

q.

Mauricio Moya (Arquesoft)

  • EA User
  • **
  • Posts: 344
  • Karma: +8/-4
  • EA Consulting and development in Spanish
    • View Profile
    • Arquehub Azure Module
Re: Creating model elements from outside EA
« Reply #3 on: February 09, 2023, 07:41:33 am »
If you are going to develop an external app, lets say, a console C# in Visual Studio, you have to check the compilation mode (32 or 64 bits) according to the version of EA you are using. Note that after version 16 you have both 32 and 64 bits options, and before v16 only 32 bits available.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13497
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating model elements from outside EA
« Reply #4 on: February 09, 2023, 10:17:02 am »
If you are going to develop an external app, lets say, a console C# in Visual Studio, you have to check the compilation mode (32 or 64 bits) according to the version of EA you are using. Note that after version 16 you have both 32 and 64 bits options, and before v16 only 32 bits available.
You can simply compile in AnyCPU, that works with both 32 and 64 bit EA installations.

Geert

Doubter

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Creating model elements from outside EA
« Reply #5 on: February 10, 2023, 02:12:42 am »
Thank you all very much for your replies!
I will look into it and get back here if I have any more questions.

Best regards
Thomas