Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: alvinhsieh on July 12, 2006, 07:47:34 pm

Title: 'How can I use Package's Element to get Package's
Post by: alvinhsieh on July 12, 2006, 07:47:34 pm
HI,
'How can I use Package's Element to get Package's PackageGUID ???
'in some case  The Package's Element's ElementGUID  is not EQ. Package's PackageGUID ???
'EA 6.1-B791,JET3.5 , VB6
'-----------------------------
Public Function Check_Package(ByVal o_package As EA.package) As String
Dim pkg As EA.package
Dim C_package As EA.package
Dim x As Integer
Dim Elm As EA.Element

Set Elm = o_package.Element
 
 
  If Elm.ElementGUID <> o_package.PackageGUID Then
 
 
  Stop

   
 End If
 
   For x = 0 To o_package.Packages.count - 1
      Set pkg = o_package.Packages.GetAt(x)

        Call Check_Package(pkg)
        DoEvents
   Next
 

End Function
Title: Re: 'How can I use Package's Element to get Packag
Post by: «Midnight» on July 13, 2006, 04:34:43 am
The package's Element attribute returns an element. This is to allow you to retrieve those properties of the package that are common to all UML elements. However, the package-specific features of the package should still be addressed using the Package element itself.

The can be a bit confusing, since both a Package and an Element can have a Packages collection, for example. As a rule of thumb - on which I might well be corrected by Sparx of other users - if the Package class provides the attribute or operation you need use that. Only use the Package.Element property if there is nothing offered at the Package level.

HTH, David