Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Geert Bellekens on May 29, 2020, 05:09:36 pm

Title: Import MDG into model automatically
Post by: Geert Bellekens on May 29, 2020, 05:09:36 pm
I've been doing some work automating some of the stuff I do with UML profiles and MDG's

I now have a little script that generates my profiles, and then also generates the MDG technology; so far so good.

Now the next step is to import that MDG file into my model, and it looks like they thought of that as well. I found the operation Repository.ImportTechnology, which takes an xml string as parameter.
But when I tried that, it didn't overwrite my existing model MDG as I expected, it created a new MDG in the model in a way I couldn't do manually.
Underneath the MDG in the resources window I saw a package for patterns, a package for profiles, and one for code engineering, and in the "manage MDG technologies" the location of the MDG was not "model", but "project"

The documentation does mention something that it is related to pre-version 7 technologies, so maybe this is some very old forgotten relic from ye olde days?

Anyways, I'm still looking for a way to import an MDG file into a model with a script. Anyone happen to know if that is possible (and if so, how)?

Thanks

Geert
Title: Re: Import MDG into model automatically
Post by: Uffe on May 29, 2020, 06:56:52 pm
I've been doing some work automating some of the stuff I do with UML profiles and MDG's
Oh snap! You too? :)
Quote
The documentation does mention something that it is related to pre-version 7 technologies, so maybe this is some very old forgotten relic from ye olde days?
Pretty sure it is.
Quote
Anyways, I'm still looking for a way to import an MDG file into a model with a script. Anyone happen to know if that is possible (and if so, how)?

Well I haven't tried it, but an imported technology is placed in t_document with:
... plus presumably the actual data in BinContent, but I haven't checked. All other columns show up as empty in EA's query results.

t_document is generally safe to insert into, isn't it? I mean, you don't have to perform any t_xref black magic right?

In which case a simple Repository.Execute() ought to do it.


/Uffe
Title: Re: Import MDG into model automatically
Post by: Geert Bellekens on May 29, 2020, 08:32:21 pm
Yeah, maybe one day I'll hack something together using Repository.Execute.
For now I'll guess I'll just have to import the MDG manually.

Geert
Title: Re: Import MDG into model automatically
Post by: davor on September 20, 2024, 11:46:00 pm
I now have a little script that generates my profiles, and then also generates the MDG technology; so far so good.

Could you share the script (example) or point to relevant docs?
Title: Re: Import MDG into model automatically
Post by: Geert Bellekens on September 21, 2024, 12:29:46 am
Code: [Select]
'[path=\Framework\Tools\UML Profile]
'[group=UML Profile]
option explicit

!INC Local Scripts.EAConstants-VBScript
!INC Wrappers.Include

'
' Script Name: Generate EAM profiles and MDG
' Author: Geert Bellekens
' Purpose: Generate the EAM profiles and MDG
' Date: 2020-05-18
'
const outPutName = "Generate EAM"

sub main
'create output tab
Repository.CreateOutputTab outPutName
Repository.ClearOutput outPutName
Repository.EnsureOutputVisible outPutName
'map O: drive
dim shell
set shell = CreateObject ("WScript.Shell")
shell.run "cmd.exe /C subst o: c:\odrive", 0, true
'set timestamp
Repository.WriteOutput outPutName, now() & " Starting generate EAM MDG", 0
'Generate profiles
Repository.WriteOutput outPutName, now() & " Generating profile for 'EAM UML profile'", 0
Repository.SavePackageAsUMLProfile "{C259CE5D-901F-4eed-94D8-C760B306F6E8}", "" 'EAM UML profile
Repository.WriteOutput outPutName, now() & " Generating profile for 'EAM Diagram profile'", 0
Repository.SaveDiagramAsUMLProfile "{BA8F0EA9-9029-42b1-807B-EEBB636DB9C1}", "" 'EAM Diagram profile
Repository.WriteOutput outPutName, now() & " Generating profile for 'EAM Toolbox profile'", 0
Repository.SaveDiagramAsUMLProfile "{CD1D434A-60DC-4611-ACE4-ADB0A33F1D78}", "" 'EAM Toolbox profile
Repository.WriteOutput outPutName, now() & " Generating profile for 'OS Toolbox profile'", 0
Repository.SaveDiagramAsUMLProfile "{DCAC2032-24D0-4d7b-A99A-6E0B68C284F1}", "" 'OS Toolbox profile

Repository.WriteOutput outPutName, now() & " Generating profile for 'Change Management UML profile'", 0
Repository.SavePackageAsUMLProfile "{6657AC40-D2B2-4862-90E5-9327CDB6FFA0}", "" 'Change Management UML profile
Repository.WriteOutput outPutName, now() & " Generating profile for 'Change Management Diagram profile'", 0
Repository.SavePackageAsUMLProfile "{1A2CC264-B4EF-47db-8DAF-DAF9F992E5D9}", "" 'Change Management Diagram profile
Repository.WriteOutput outPutName, now() & " Generating profile for 'Change Management toolbox profile'", 0
Repository.SaveDiagramAsUMLProfile "{B0288241-37B7-4f50-9763-94974FA92497}", "" 'Change Management toolbox profile

'Generate MDG
Repository.WriteOutput outPutName, now() & " Generating EAM MDG technology", 0
Repository.GenerateMDGTechnology "O:\Sparx\MDG\EAM MDG.mts"
'set timestamp
Repository.WriteOutput outPutName, now() & " Finished generate EAM MDG", 0
end sub

main

Geert
Title: Re: Import MDG into model automatically
Post by: davor on September 24, 2024, 09:30:24 pm
Thank you very much!