81.6.5 An example of adding a GUI plug-in to the Plug-ins menu

You use the registerGuiMenuButton() command to make a GUI plug-in available from the Plug-ins menu. The following example shows how you can use registration commands to add a GUI plug-in that creates a form that posts a dialog box prompting the user for input. When the user selects Plug-insMy Utility, Abaqus/CAE activates the form.

Registration commands for kernel plug-ins must reside in a file separate from the kernel plug-in code. In contrast, registration commands for GUI plug-ins can reside in a separate file or in the GUI plug-in file itself. This example shows how you can combine the registration commands and the GUI plug-in code into a single file.

from abaqusGui import AFXForm, getAFXApp

class MyForm(AFXForm):
                
    form code goes here

toolset = getAFXApp().getAFXMainWindow().getPluginToolset()
toolset.registerGuiMenuButton(buttonText='My Utility', 
    object=MyForm(toolset) )

When you make a GUI plug-in available from the Plug-ins menu or from a toolbox, the registration command references a GUI object that receives a message when the plug-in is selected. The selector of the message is generated by combining the message ID that you specify together with the SEL_COMMAND message type. In most cases you will supply a form or procedure as the GUI object and use ID_ACTIVATE (the default) for the message ID. Forms and procedures prompt the user for input, in most cases using a dialog box or the prompt line. After receiving input from the user, forms and procedures then issue commands to the kernel. For details on creating forms, procedures, and dialog boxes, see Chapter 7, Modes,” of the Abaqus GUI Toolkit User's Guide and Chapter 5, Dialog boxes,” of the Abaqus GUI Toolkit User's Guide. You can also create simple dialog boxes using the Really Simple GUI Builder plug-in; for more information, see Creating dialog boxes with the Really Simple GUI (RSG) Dialog Builder, Section 82.4.