Reputation: 343
Using scripting in Enterprise Architect I can create diagram Use Case of UML:
testElement = subPackage.Elements.AddNew( "New diagram", "Use Case" );
testElement.Update();
But how to create non-UML diagram? It's about second parameter of AddNew function. In documentation, there is
This can be either a standard UML metaclass type (such as 'Class' or 'UseCase') or a fully-qualified metatype defined by an MDG Technology (such as 'BPMN2.0::BusinessProcess' or 'SysML1.4::Block').
But what is fully-qualified metatype defined by an MDG Technology? I tried something like "Extended::Requirements Diagram", but it didn't work.
Upvotes: 1
Views: 438
Reputation: 36313
Almost. It's Extended::Requirements
.
Next time create the diagram you want and look into t_diagram.StyleEx
where you find the stereotype after MDGDgm=
.
Geert pointed out one issue in your code. If you want to add a diagram to an element you need to do:
newDiagram = testElement.Diagrams.AddNew( "New diagram", "Extended::Requirements" );
newDiagram.Update();
or use Geert's code for a package.
Upvotes: 2
Reputation: 13750
You can't add a Diagram in the Elements collection.
The code you posted creates a Use Case , not a diagram.
So the correct code would be
newDiagram = subPackage.Diagrams.AddNew( "New diagram", "Extended::Requirements" );
newDiagram.Update();
Upvotes: 2