Deriving a new class to create modified Abaqus/CAE modules and toolsets allows you to customize existing functions without changing the original functions. You can also access existing Abaqus/CAE functions from within new dialogs that you create with the Abaqus GUI Toolkit. The following topics are covered in this section:
The Abaqus GUI Toolkit is designed to allow you to add your own modules and toolsets. It is generally not recommended that you modify Abaqus/CAE modules and toolsets because future changes to Abaqus/CAE may “break” your application. However, if you do have a need to modify some of the Abaqus/CAE modules or toolsets, you can make changes by deriving a new class from one of them and then adding or removing components.
To derive a new class, you must know the appropriate class name and you must call that class's constructor in your constructor. The table below lists the class names and registered names for all the Abaqus/CAE modules that are available in the Abaqus GUI Toolkit. You can import these class names from abaqusGui.
When you register a module derived from one of the Abaqus/CAE modules, you must use the name shown in the table for the displayedName argument in the main window's registerModule method. If you do not use the name shown, some GUI infrastructure components may not function correctly.
Class name | Name |
---|---|
PartGui | “Part” |
PropertyGui | “Property” |
AssemblyGui | “Assembly” |
StepGui | “Step” |
InteractionGui | “Interaction” |
LoadGui | “Load” |
MeshGui | “Mesh” |
OptimizationGui | “Optimization” |
JobGui | “Job” |
VisualizationGui | “Visualization” |
SketchGui | ”Sketch” |
When you register a toolset, you must specify in the registerToolset method in which locations (the menu bar, the toolbar, or the toolbox) the toolset creates the widget. If you omit a toolset location flag, the GUI for that toolset will not appear in that location. The table below shows the class name for each of the Abaqus/CAE toolsets along with the flags that indicate the locations in which the toolset creates the widgets. You can import these class names from abaqusGui.
To register the plug-in toolset, you call registerPluginToolset(); you do not use the registerToolset method.
When you unregister a toolset, you must use the name shown in the table as the argument to the module's unregisterToolset method.
Class name | Name | Toolset locations |
---|---|---|
AmplitudeToolsetGui | “Amplitude” | GUI_IN_TOOL_PANE |
AnnotationToolsetGui | “Annotation” | GUI_IN_MENUBAR | GUI_IN_TOOLBAR |
CanvasToolsetGui | “Canvas” | GUI_IN_MENUBAR |
CustomizeToolsetGui | “Customize” | GUI_IN_TOOL_PANE |
DatumToolsetGui | “Datum” | GUI_IN_TOOLBOX | GUI_IN_TOOL_PANE |
EditMeshToolsetGui | “Mesh Editor” | GUI_IN_TOOLBOX | GUI_IN_TOOL_PANE |
FileToolsetGui | “File” | GUI_IN_MENUBAR | GUI_IN_TOOLBAR |
HelpToolsetGui | “Help” | GUI_IN_MENUBAR | GUI_IN_TOOLBAR |
ModelToolsetGui | “Model” | GUI_IN_MENUBAR |
PartitionToolsetGui | “Partition” | GUI_IN_TOOLBOX | GUI_IN_TOOL_PANE |
QueryToolsetGui | “Query” | GUI_IN_TOOLBAR | GUI_IN_TOOL_PANE |
RegionToolsetGui | “Region” | GUI_IN_TOOL_PANE |
RepairToolsetGui | “Repair” | GUI_IN_TOOLBOX | GUI_IN_TOOL_PANE |
SelectionToolsetGui | “Selection” | GUI_IN_TOOLBAR |
TreeToolsetGui | “Tree” | GUI_IN_MENUBAR |
ViewManipToolsetGui | “View Manipulation” | GUI_IN_MENUBAR | GUI_IN_TOOLBAR |
# File myVisModuleGui.py: from abaqusGui import * from myToolsetGui import MyToolsetGui class MyVisModuleGui(VisualizationGui): def __init__(self): # Construct the base class. # VisualizationGui.__init__(self) # Register my toolset. # self.registerToolset(MyToolsetGui(), GUI_IN_MENUBAR|GUI_IN_TOOLBOX) MyVisModuleGui() # File myMainWindow.py: from abaqusGui import * class MyMainWindow(AFXMainWindow): def __init__(self, app, windowTitle=''): ... self.registerModule('Visualization', 'myVisModuleGui') ...
If you derive a toolset from an Abaqus/CAE toolset, you must construct that toolset using the makeCustomToolsets method of AFXMainWindow. You must use the makeCustomToolsets method to ensure that the toolset is created at the appropriate time during application startup. This will avoid any conflicts with Abaqus/CAE modules that also make use of the module. For example, if you derive a new toolset from the Datum toolset, you must create the new toolset in makeCustomToolsets. This approach is illustrated in the following example. The new toolset will also appear in the Part module in place of the standard Datum toolset.
# In your main window file: class MyMainWindow(AFXMainWindow): def __init__(self, app, windowTitle=''): ... def makeCustomToolsets(self): from myDtmToolsetGui import MyDtmGui # Store the toolset as a member of the main window if # you want to register it in one of your modules too. # self.myDtmGui = MyDtmGui() # In your module GUI file: class MyModuleGui(AFXModuleGui): def __init__(self): ... mw = getAFXApp().getAFXMainWindow() self.registerToolset(mw.myDtmGui, GUI_IN_TOOL_PANE|GUI_IN_TOOLBOX)
If you want to launch an Abaqus/CAE function from your own dialog, you can do so by connecting the appropriate target and selector to one of your buttons. You can get the target and selector for a particular function by using the main window's getTargetFromFunction and getSelectorFromFunction methods. For example:
mainWindow = getAFXApp().getAFXMainWindow() target = mainWindow.getTargetFromFunction('Part->Create') selector = mainWindow.getSelectorFromFunction('Part->Create') FXButton(self, 'Create Part...', tgt=target, sel=selector )The list of valid function names can be found in the Functions tab page in the Tools