All commands are ultimately executed in the kernel process, but there are several ways this can be accomplished:
You can execute kernel commands from a file by using the –start or –replay options on the command line.
You can execute kernel commands from a file by using FileRun Script
You can type kernel commands in the Abaqus/CAE CLI
The GUI mode infrastructure can send a command string from the GUI to the kernel process for execution (see “Command processing,” Section 7.2.4 for details).
You can issue a kernel command directly from the GUI using the sendCommand function.
The sendCommand function takes three arguments:
A required string argument specifying the command to be executed in the kernel.
Two optional Boolean arguments, writeToReplay and writeToJournal.
Abaqus Scripting Interface commands automatically journal themselves. As a result, if you use the sendCommand function to issue an Abaqus Scripting Interface command, you should not set writeToJournal=True. Otherwise, the command will be recorded twice in the journal file. For more information, see “Abaqus/CAE command files,” Section 9.5 of the Abaqus/CAE User's Guide.
If you write your own kernel scripting module and functions, you should be aware that you can use the journalMethodCall function to record a command in the journal file. This option is preferable to using the writeToJournal argument in the sendCommand function. Your command should not call journalMethodCall if the command changes the Mdb object using built-in Abaqus Scripting Interface commands, because these are journaled by default. A command that changes the customData of the Mdb should call journalMethodCall. For an example that illustrates one common use of the journalMethodCall function, see “journalMethodCall,” Section 53.11.1 of the Abaqus Scripting Reference Guide.
In general, you should enclose the sendCommand function in a try block to catch any exceptions that might be thrown by the kernel command. In order for exceptions to be caught, they should be class-based exceptions and not simply strings. For example:
from abaqusGui import sendCommand try: sendCommand("mdb.customData.myCommand('Cmd-1', 50, 200)" except ValueError, x: print 'an exception was raised: ValueError: %s' % (x) except: exc_type, exc_value = sys.exc_info()[:2] print 'error. %s.%s'%(exc_type.__name__, exc_value)