Author Topic: Create MDG via script?  (Read 5767 times)

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Create MDG via script?
« on: October 09, 2018, 06:35:43 pm »
Hello,

is it possible to create an MDG from an EA Script?
Assuming I have already several xml files containing my UML profile, my own toolbox, my own diagram type, etc.
And, most important, I have already a correct and complete *.mts file.

I would now like to create the MDG.xml file running a script, instead of clicking through the dialog window.
Is that possible?
So far I have not found any information on that in the reference of the automation interface.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Create MDG via script?
« Reply #1 on: October 09, 2018, 07:38:40 pm »
I don't think there is any support for it in the API, but it it is not rocket science either.
If you wanted to do it yourself you would basically need to put the different sources into a big XML file.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Create MDG via script?
« Reply #2 on: October 10, 2018, 12:51:07 am »
What's even better with assembling the MDG from XMLs yourself is that you can look into the latter and detect whether they contain what they should (so is it a profile, for toolboxes, patterns, etc.). EA does not do that but blindly copies the files you pointed it to. I can't count how often I saved a profile at the wrong place (since EA does not remember the preferred place to save) which led to a just not working MDG ("go, figure" EA lets me stand in the rain) - well, until I did the assembly myself.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Create MDG via script?
« Reply #3 on: October 10, 2018, 01:47:55 am »
What's even better with assembling the MDG from XMLs yourself is that you can look into the latter and detect whether they contain what they should (so is it a profile, for toolboxes, patterns, etc.). EA does not do that but blindly copies the files you pointed it to. I can't count how often I saved a profile at the wrong place (since EA does not remember the preferred place to save) which led to a just not working MDG ("go, figure" EA lets me stand in the rain) - well, until I did the assembly myself.

q.
Version 14.1 now remembers where you last save the package/diagram as a profile thus avoiding these common mistakes.
You see sometimes they listen to us  :)

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Create MDG via script?
« Reply #4 on: October 10, 2018, 06:13:14 am »
I can't remember when I first asked for that. At least 5 years ago. At least!

q.

Boron

  • EA User
  • **
  • Posts: 111
  • Karma: +6/-0
    • View Profile
Re: Create MDG via script?
« Reply #5 on: October 12, 2018, 06:01:18 pm »
Thanks guys.
If it is really that easy, not all my faith in mankind is lost :).

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Create MDG via script?
« Reply #6 on: October 15, 2018, 10:57:02 am »
SavePackageAsUMLProfile, SaveDiagramAsUMLProfile and GenerateMDGTechnology were added to the Repository class in EA 14 to help with building Profiles and Technologies via script.
https://sparxsystems.com/enterprise_architect_user_guide/14.0/automation/repository3.html

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Create MDG via script?
« Reply #7 on: October 15, 2018, 05:53:32 pm »
SavePackageAsUMLProfile, SaveDiagramAsUMLProfile and GenerateMDGTechnology were added to the Repository class in EA 14 to help with building Profiles and Technologies via script.
https://sparxsystems.com/enterprise_architect_user_guide/14.0/automation/repository3.html
Yes!
In fact I saw that and then promptly forgot about it :-[

Geert