|Re: Create diagram programmatically from uml file [message #1795666 is a reply to message #1795266]
||Wed, 26 September 2018 14:03
|| Quentin Le Menez
Registered: September 2014
Location: Paris Saclay, France
Sorry for the delay.
If you want to create it via papyrus, what you will need is, afaik, fairly complex but here are the pointers I can give you:
0- First of you will need to have a Papyrus editor opened
1- get the type of diagram you want to create and its associated ViewPrototype
2- create a ModelSet from the Papyrus MultiDiagramEditor through the service Registry
3- then create your diagram through a CreationCommandDescriptor.getComand().createDiagram(modelset, root, diagramName)
4- from there you will need to get from the editor its associated ServiceRegistry, TransactionalEditingDomain and Diagram page.
5- open the created diagram in it so as to be able to drop your elements in it through OpenDiagramCommand
6- drop your elements in the now active part through a drop request
you will then have your diagram created and populated. Although you won't have its elements organized so you might have to do a little cleanup by hand. Unless you want to use an automatic tool like ELK.
You can look at an example of this in the DiagramTemplate tool . There should be a second release shortly but I have no time frame on it yet.
Powered by FUDForum
. Page generated in 0.01719 seconds