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

Add and Manage Packages

This example illustrates how to add a Model or a Package to the project.

Sub TestPackageLifecycle

     Dim idx as integer

     Dim idx2 as integer

     Dim package as object

     Dim model as object

     Dim o as object

     ''first add a new Model

     model = m_Repository.Models.AddNew("AdvancedModel","")

     If not model.Update() Then


     End If

     ''refresh the models collection


     ''now work through models collection and add a package

     For idx = 0 to m_Repository.Models.Count -1

          o = m_Repository.Models.GetAt(idx)


          If o.Name = "AdvancedModel" Then

               package = o.Packages.Addnew("Subpackage","Nothing")

               If not package.Update() Then


               End If

               package.Element.Stereotype = "system"


               ''for testing purposes just delete the

               ''newly created Model and its contents


          End If


End Sub