When reverse engineering existing source code into Enterprise Architect, there is an option to import dependency relationships based on operation return types and parameter types. These dependencies are only shown between individual classes. Some users however, wish to view implicit dependencies at the Package level, which Enterprise Architect does not generate by default.
The purpose of these scripts is to generate implicit dependencies at the package level based on the contents of the packages, and to assist with drawing a diagram to show these cross-package dependencies.
In this example, we will take advantage of the new ability to call scripts directly from the Project Browser, introduced in Enterprise Architect 8.0.
With the scripts successfully added to your model, select the root package in the Project Browser from where you wish to generate your cross-package dependencies. To see the messages output by this script, make sure to open the Output window (View | System Output).
These scripts can be executed again at any later time to update any changes in your cross-package dependencies that may have occurred since the original execution. Dependency relationships are added and removed between packages as necessary by running the “Synchronize Package Dependencies” script, and running the “Synchronize Package Dependency Diagram” script again can automatically add/remove packages from the currently open package diagram to show the items that are now relevant. If any items are added or removed from the diagram, you may need to run the automatic diagram layout tools again.

This article contains content available for registered members only. You need to be logged in to view/download this content.
Comments
I imported C# packages as source code, own package for each namespace. Then tried to get dependencies between packages but it didn't find any dependency: "55 Packages synchronized, 0 Dependencies Added, 0 Dependencies Removed." What kind of dependencies it requires? And does source code importing insert those dependencies?
by Tapio Taipale on Fri, 11/11/2011 - 17:12.
Hi, I'm wondering if it's also possible to use these scripts in Enterprise Architect 7.5, cause it's the version that we are using right now.
by Yanjun Xu-Abend... on Tue, 15/03/2011 - 02:50.
The code has been written to take adivantage of Enterprise Architect 8 features (eg Script Groups). However, the code can be easily adapted to be used by the Automation Interface in 7.5.
by Sparx Systems on Wed, 16/03/2011 - 16:08.
There is a LayoutDiagramEx function available on the EA.Project interface which performs the equivalent of the "Layout Diagram" command in Enterprise Architect as seen on the following user guide page:
http://www.sparxsystems.com/enterprise_architect_user_guide/modeling_fun...
Other layout algorithms provided by the Layout Tools window are not currently available via automation. Layout of the objects on your diagram can also be performed more explicitly by looping through the contents of your diagram (i.e. using the Diagram.DiagramObjects) and setting the Top, Bottom, Left and Right attributes on the EA.DiagramObject references.
by Sparx Systems on Wed, 08/09/2010 - 13:16.
Hi there; I really apptreciate your helpful guidance here. I would like to know how i can write a VB script inside EA to layout my objects on a specific diagram. Please help me with that. Regards; Amir Basirat
by amir basirat on Fri, 21/05/2010 - 17:59.