Startup script

Every application is started from a short startup script.

The startup script performs the following tasks:

  • Initializes an application object. The application object is responsible for high-level functions, such as managing message queues and timers and updating the GUI, and controlling the main window. It is not a visible object.

  • Instantiates a main window. The main window is what the user sees when the application is first started and provides access to all of the application’s functionality.

  • Creates and runs the application. Once the application is run, it enters an event loop where it waits to react to user input, such as the click of a mouse.

The following illustrates a typical startup script.

from abaqusGui import *
import sys
from caeMainWindow import CaeMainWindow

#Define a custom callback, myStartupCB(), that will be invoked 
#once the application has finished its startup processing
#
def myStartupCB():
    from myStartupDB import MyStartupDB
    db = MyStartupDB()
    db.create()
    db.show()

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

# Create the application
#
app.create()

# Register the custom startup callback
#
# NOTE: This call must be made after app.create()
setStartupCB( myStartupCB )

#Run the application
#
app.run()

The first statement in the script imports all constructors, including 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.

This startup script has been customized to include a startup callback function that will display a custom dialog, MyStartupDB, after the application starts. The callback is defined after the import statements and before the application is initialized. The next statements instantiate and initialize the application object. The application object is discussed in more detail in The application object. 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 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. Next, the custom callback startup function is registered.

The app.run() statement displays the application, including the custom startup dialog, and then enters an event loop. The event loop then waits for user interaction.

When you start your custom application, you may want to use the –noStartup option in the Abaqus/CAE execution procedure to prevent Abaqus/CAE from posting its own startup dialog. For more information, see Abaqus/CAE execution.