I am trying to add a legend to a digram partly following question: Enterprise Architect scripting with java - add CustomProperty but I have no luck in getting a visible legend on my diagram. Here is my code:
function addLegend()
{
Repository.EnsureOutputVisible( "Script" );
Repository.ClearOutput("Script");
var pkg as EA.Package;
pkg = Repository.GetTreeSelectedPackage();
elements = pkg.Elements;
var legend = elements.AddNew('Diagram Legend', 'Text');
legend.Subtype = 76;
legend.Update();
elements.Refresh();
var diagram as EA.Diagram;
diagram = Repository.GetDiagramByID(10);
Session.Output(diagram.Name);
diagramObjects = diagram.DiagramObjects;
diagramObject = diagramObjects.AddNew("l=100; r=100; t=100; b=500;", "");
diagramObject.ElementID = legend.ElementID;
diagramObjects.Refresh();
diagram.Update();
}
` As said no legend is displayed - any help appreciated. My EA version is 12.0.
AddNew.
but by the size of the title – Jens R