Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: philchudley on March 31, 2009, 10:09:53 pm

Title: Diagram ID from a UML Diagram Element
Post by: philchudley on March 31, 2009, 10:09:53 pm
Does anyone know of a method using the Object Model how to obtain the diagram to which a Diagram reference (UML Diagram Element)?

I am looking to obtain either the diagram ID or the diagram GUID

Cheers
Title: Re: Diagram ID from a UML Diagram Element
Post by: Andrew Taylor on June 03, 2009, 07:46:17 am
Try this:

EA.Repository repo;
EA.Element element;

repo = ..... your repository
element =  ...... an element with Type == "UMLDiagram"

int diagram_id = Int16.Parse(element.get_MiscData(0));
EA.Diagram diagram = repo.GetDiagramByID(diagram_id);


Obvious, isn't it?   :o