Examples and Tips
Topics
|
|
|
Usage
|
Instructions for using the interface are provided through sample code. There are several sets of examples:
• | VB 6 and C# examples are available in the Code Samples folder under your Enterprise Architect installation
(default: C:\Program Files\Sparx Systems\EA\Code Samples) |
• | Enterprise Architect can be set up to call an external application |
• | Several VB.NET code snippets are provided in the reference section |
• | A comprehensive example of using Visual Basic to create MS Word documentation is available from the internet at www.sparxsystems.com/resources/developers/autint_vb.html |
• | Additional samples are available from the Sparx Systems website; see the Available Resources topic |
|
Call an External Application
Code Samples
www.sparxsystems.com/resources/developers/autint_vb.html
Available Resources
|
Tips and Tricks
|
Additionally, you should note the following tips and tricks:
• | An instance of the Enterprise Architect (EA.exe) process is executed when you initialize a new repository object - this process must remain running in order to perform automation tasks; if the main window is visible, you can safely minimize it, but it must remain running |
• | The Enterprise Architect ActiveX Interface is a functional interface rather than a data interface; when you load data through the interface there is a noticeable delay as Enterprise Architect user interface elements (such as Windows and menus) are loaded and the specified database connection is established |
• | Collections use a zero-based index; for example, Repository.Models(0) represents the first model in the repository |
• | During the development of your client software your program might terminate unexpectedly and leave EA.exe running in such a state that it is unable to support further interface calls; if your program terminates abnormally, ensure that Enterprise Architect is not left running in the background (see the Windows Task Manager / Process tab) |
• | A handle to a currently running instance of Enterprise Architect can be obtained through the use of a GetObject() call (see the reference page for the App object); accessing your Enterprise Architect model via the App object enables querying the current User Interface status, such as using GetContextItem() on the Repository object to detect the current selection by the user, allowing for rapid prototyping and testing |
|
Repository Class
App Class
|
Enterprise Architect Not Closing
|
If your automation controller was written using the .NET framework, Enterprise Architect does not close even after you release all your references to it.
To force the release of the COM pointers, call the memory management functions as shown below:
GC.Collect();
GC.WaitForPendingFinalizers();
There are additional concerns when controlling a running instance of Enterprise Architect that loads Add-Ins - see the Tricks and Traps topic for details.
|
Tricks and Traps
|
The material ("material" includes all pages, documents and on-line graphics) on this web site is protected by copyright law. (C) 1998-2011 Sparx Systems Pty Ltd.