Book a Demo

Author Topic: Scripting: how to set the correct perspective when adding an element  (Read 4703 times)

rmvanderlinden

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
I have a script that adds elements (ApplicationComponent). In the beginning it has the Archimate3 perspective, but now it uses TOGAF.
How can I force to use the Archimate3?

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1173
  • Karma: +30/-8
    • View Profile
 2 different types of diagrams or 2 different types of application components could have been used, intentionally or unintentionally.

Have you tried changing the type of the diagrams to an ArchiMate diagram?

rmvanderlinden

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
No diagrams are involved. The script is within Excel, it reads the rows and, if necessary, creates the root/view/package structure and puts elements in it (together with notes, tags, etc.). Like the picture. The <ApplicationComponent> has the TOGAF stereotype. I want it to be an Archimate3 stereotype.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1173
  • Karma: +30/-8
    • View Profile
You need to change the type of element and its stereotype. Just make sure that you remove the TOGAF stereotype.

rmvanderlinden

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
How is this done?
I used .StereoType (ApplicationComponent) and .StereoTypeEx (Archimate3::ApplicationComponent). It has however no effect.
A code snippet:

                    Set e = EARepos.GetElementByGuid(.GUID)
                    If e Is Nothing Then
                        Select Case sp
                            Case eSubPackage.ApplicationType: spn = .tagApplicationType
                            Case eSubPackage.BusinessUnit:    spn = .tagBusinessUnit
                            Case eSubPackage.Platform:        spn = .tagPlatform
                            Case Else:                        spn = ""
                        End Select
                        If (spn <> "") Then
                            Set pk = Me.getPackage(Path & spn)
                            Set e = pk.Elements.AddNew(.Name, .StereoType)
                        Else
                            Set e = p.Elements.AddNew(.Name, .StereoType)
                        End If
                    End If
                    ' Optionaly set elements if they have a value. They are not (yet) supported by the Collection tab
                    If .Alias <> "" Then e.Alias = .Alias
                    If .Phase <> "" Then e.Phase = .Phase
                    If .Status <> "" Then e.Status = .Status
                    If .FQStereoType <> "" Then
                        e.StereotypeEx = .FQStereoType
                    Else
                        If .StereoType <> "" Then e.StereoType = .StereoType
                    End If
                    If .Version <> "" Then e.Version = .Version
                    If .Notes <> "" Then e.Notes = .Notes

« Last Edit: May 14, 2025, 06:28:41 pm by rmvanderlinden »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
You should never use the regular stereotype, as that risks conflicting.
Always use the fully qualified stereotype.

But more importantly, make sure you have the correct steretoype. There is no "ApplicationComponent" steretoype in ArchiMate. It's "Archimate_ApplicationComponent"

Geert

rmvanderlinden

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Geert,
The Archimate_ before the type did the trick.