Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Add and Manage Elements




public Object


''Add and delete elements in a package.


Sub ElementLifecycle


   Dim package as Object

   Dim element as Object


   package = m_Repository.GetPackageByID(2)

   element = package.elements.AddNew("Login to Website","UseCase")

   element.Stereotype = "testcase"




   Dim idx as integer



   ''note the repeated calls to "package.elements.GetAt"

   ''in general you should make this call once and assign to a local

''variable - in the example below, Enterprise Architect loads the

''element required every time a call is made - rather than loading once

''and keeping a local reference.


   For idx = 0 to package.elements.count-1


       If (package.elements.GetAt(idx).Name = "Login to Website" and _

           package.elements.GetAt(idx).Type = "UseCase") Then

                   package.elements.deleteat(idx, false)

       End If


End Sub