Kernel initialization scripts specified by the startup command line option are executed by Abaqus/CAE after it has finished its initialization process. By that time, a new model database or a database specified on the command line using the database option has already been opened. A utility method called processInitialMdb has been created to automatically process the initial model database for you. If the initial model database does not have any customData or does not have customData for your particular application, your initializeMdb method will be called. If the initial model database has customData for your application, your verifyMdb method will be called. The following example shows how you can use the verifyMdb, intializeMdb, and processInitialMdb methods. You should execute the example using the startup command line option when you start Abaqus/CAE. For more information, see Abaqus/CAE execution. from abaqus import mdb, session import customKernel myAppName = 'My App' myAppData = customKernel.AbaqusAppData() myAppData.majorVersion = 1 myAppData.minorVersion = 1 myAppData.updateVersion = 1 customKernel.setAppData(myAppName, myAppData) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def verifyMdb(mdbAppData): # If there is no appData, initialize the MDB. # if mdbAppData==None: initializeMdb() return # If my application is not in appData, initialize the MDB. # if not mdbAppData.has_key(myAppName): initializeMdb() return # Perform any checks on the appData or customData here # Set the verifyMdb method for the application. # setVerifyMdb may be called only once per application name. # customKernel.setVerifyMdb(myAppName, verifyMdb) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def initializeMdb(): # Initialize the MDB here # Set the initializeMdb method for this application. # setInitializeMdb may be called only once per application name. # customKernel.setInitializeMdb(myAppName, initializeMdb) # This file is executed after Abaqus/CAE has started, so we need to # process the initial MDB (either a new, empty MDB created by Abaqus/CAE, # or a database opened via the -database command line argument). # customKernel.processInitialMdb(myAppName) |