The startup script performs the following tasks:
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. |