1
Automation Interface, Add-Ins and Tools / Re: Sequence Diagram Properties
« on: March 03, 2004, 05:13:32 pm »
So I created a little .net app to interate through some of the sequence diagrams in the eaexample.eap that ships with EA. Interestingly, the diagramlinks collection associated with a diagram do not always show up in the diagramlinks collection. The example below (it's just a form with one button) drills down to the Manage Contacts package and loads the CreateContact Sequence Diagram. The DiagramLinks count is 0 for this diagram even though there are a bunch of diagramlinks on the page. If I do the same things on another sequence diagram, such as the "SE0002 Setup " sequence diagram in EAExample.eap, all of the diagramlinks come back and the count is 14. I wish someone would explain this to me!!
Dim Package As EA.Package
Dim EARepos As New EA.Repository
EARepos.OpenFile("C:\Program Files\Sparx Systems\EA\EAExample.eap")
Package = EARepos.Models.GetByName("Messenger")
Package = Package.Packages.GetByName("Model Views")
Package = Package.Packages.GetByName("Analysis Model")
Package = Package.Packages.GetByName("Use Case Collaborations")
Package = Package.Packages.GetByName("Manage Contacts")
Dim idx As Integer, diag As EA.Diagram
For idx = 0 To Package.Diagrams.Count - 1
Dim idx2 As Integer, DiagramName As String
diag = Package.Diagrams.GetAt(idx)
DiagramName = diag.Name
For idx2 = 0 To diag.DiagramLinks.Count - 1
Dim CurrDiagramLink As EA.DiagramLink
CurrDiagramLink = diag.DiagramLinks.GetAt(idx2)
Dim ini As Long
ini = CurrDiagramLink.ConnectorID
Dim CurrConnector As EA.Connector, CurrConnectorName As String
CurrConnector = EARepos.GetConnectorByID(ini)
CurrConnectorName = CurrConnector.Name
Next
Next
Dim Package As EA.Package
Dim EARepos As New EA.Repository
EARepos.OpenFile("C:\Program Files\Sparx Systems\EA\EAExample.eap")
Package = EARepos.Models.GetByName("Messenger")
Package = Package.Packages.GetByName("Model Views")
Package = Package.Packages.GetByName("Analysis Model")
Package = Package.Packages.GetByName("Use Case Collaborations")
Package = Package.Packages.GetByName("Manage Contacts")
Dim idx As Integer, diag As EA.Diagram
For idx = 0 To Package.Diagrams.Count - 1
Dim idx2 As Integer, DiagramName As String
diag = Package.Diagrams.GetAt(idx)
DiagramName = diag.Name
For idx2 = 0 To diag.DiagramLinks.Count - 1
Dim CurrDiagramLink As EA.DiagramLink
CurrDiagramLink = diag.DiagramLinks.GetAt(idx2)
Dim ini As Long
ini = CurrDiagramLink.ConnectorID
Dim CurrConnector As EA.Connector, CurrConnectorName As String
CurrConnector = EARepos.GetConnectorByID(ini)
CurrConnectorName = CurrConnector.Name
Next
Next