Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Boron on October 09, 2018, 06:35:43 pm

Title: Create MDG via script?
Post by: Boron 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.
Title: Re: Create MDG via script?
Post by: Geert Bellekens 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
Title: Re: Create MDG via script?
Post by: qwerty 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.
Title: Re: Create MDG via script?
Post by: Geert Bellekens 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
Title: Re: Create MDG via script?
Post by: qwerty 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.
Title: Re: Create MDG via script?
Post by: Boron on October 12, 2018, 06:01:18 pm
Thanks guys.
If it is really that easy, not all my faith in mankind is lost :).
Title: Re: Create MDG via script?
Post by: Aaron B 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
Title: Re: Create MDG via script?
Post by: Geert Bellekens 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