The first two lines in the example provide access to the commands in the Plug-in toolset. The next line inserts a menu item under the Plug-ins menu in the main menu bar. When the user clicks , Abaqus/CAE issues the following command to the kernel: myUtils.printCurrentVp() The buttonText argument accepts a pipe-separated ( | ) list of words. The pipe separates submenu names from the menu button name. This allows you to group several plug-ins under one menu. For example, if you have defined more functions in myUtils.py, you can use the following version of myUtils_plugin.py to register them under a cascading menu: from abaqusGui import getAFXApp
toolset = getAFXApp().getAFXMainWindow().getPluginToolset()
toolset.registerKernelMenuButton(
buttonText='My Utils|Print Current Viewport',
moduleName='myUtils', functionName='printCurrentVp()' )
toolset.registerKernelMenuButton(
buttonText='My Utils|Print Sections',
moduleName='myUtils', functionName='printSections()' )
toolset.registerKernelMenuButton(
buttonText='My Utils|Print Materials',
moduleName='myUtils', functionName='printMaterials()' )
The previous example results in the menu structure shown in Figure 1: ![]() | |||||||