11.2 Startup script

Every application is started from a short startup script. The startup script performs the following tasks:

The following illustrates a typical startup script.

Note:  You can download this script and the files associated with it; for example, caeMainWindow.py, from the ABAQUS Process Automation Portal.

from abaqusGui import AFXApp
import sys
from caeMainWindow import CaeMainWindow

# Initialize the application object
#
app = AFXApp('ABAQUS/CAE', 'ABAQUS Inc.')
app.init(sys.argv)
# Construct the main window
#
CaeMainWindow(app)

# Create the application and run it
#
app.create()
app.run()
The first statement in the script imports the AFXApp constructor from the abaqusGui module, which contains access to the entire ABAQUS GUI Toolkit. The sys module is also imported since it is needed to pass arguments into the application’s init method. After the script imports the sys module, it imports the main window constructor.

The next statements instantiate and initialize the application object. The application object is discussed in more detail in The application object, Section 12.1. The script then instantiates the main window. The main window is what the user will see when the application is started. The main window is discussed in more detail in Chapter 13, The main window.”

The application constructor creates all the data structures needed for that object, and the app.create() statement creates all the GUI windows required by the application object. The app.run() statement displays the application and then enters an event loop. The event loop then waits for user interaction.

If you want to post your own dialog box when your application starts, you can add the following statements to your startup script. The statements should appear just before the last line of the script.

from myStartupDB import MyStartupDB
db = MyStartupDB()
db.create()
db.showModal()
When you start your custom application, you should use the –noStartup option in the ABAQUS/CAE execution procedure to prevent ABAQUS/CAE from posting its own startup dialog. For more information, see Execution procedure for ABAQUS/CAE, Section 3.2.3 of the ABAQUS Analysis User's Manual.