Auxiliary functions

This section lists various auxiliary GUI toolkit functions.


addExitCallback(callback)

Registers a callback function to be called when the application is about to exit.

ArgumentTypeDefaultDescription
callbackFunction The function to be called when the application is about to exit.


afxCreateIcon(fileName)

Returns an icon created by reading the specified file, which can be in one of these formats: BMP, GIF, PNG, XPM. The file format is assumed from the file extension (which is not case sensitive). Returns 0 if the file cannot be opened.

ArgumentTypeDefaultDescription
fileNameString File name.


afxCreateBMPIcon(fileName)

Returns an icon created by reading the specified file in BMP format. Returns 0 if the file cannot be opened.

ArgumentTypeDefaultDescription
fileNameString File name.


afxCreateGIFIcon(fileName)

Returns an icon created by reading the specified file in GIF format. Returns 0 if the file cannot be opened.

ArgumentTypeDefaultDescription
fileNameString File name.


afxCreatePNGIcon(fileName)

Returns an icon created by reading the specified file in PNG format. Returns 0 if the file cannot be opened.

ArgumentTypeDefaultDescription
fileNameString File name.


afxCreateXPMIcon(fileName)

Returns an icon created by reading the specified file in XPM format. Returns 0 if the file cannot be opened.

ArgumentTypeDefaultDescription
fileNameString File name.


afxDisableWidgetTree(widget)

Disables the specified widget and all its children.

ArgumentTypeDefaultDescription
widgetWidget The parent widget, which will be disabled along with all its children.


afxEnableWidgetTree(widget)

Enables the specified widget and all its children.

ArgumentTypeDefaultDescription
widgetWidget The parent widget, which will be enabled along with all its children.


displayURL(url)

Displays the specified URL in a web browser. Returns the status of the call. This call will use an open web browser if there is one. This method can be accessed via webBrowser.displayURL from module uti. See also openWithURL.

ArgumentTypeDefaultDescription
urlString The URL of the page to be displayed.


getAFXApp()

Returns the application object.


getAFXFont(opts=FONT_PROPORTIONAL)

Returns the specified font.

ArgumentTypeDefaultDescription
optsIntFONT_PROPORTIONALType of font to get. Possible choices are FONT_PROPORTIONAL, FONT_MONOSPACE, FONT_REGULAR, FONT_BOLD, FONT_ITALIC, FONT_BASE, or FONT_SMALL.


afxGetColorHexSpecFromID(colorId)

Returns the equivalent hex string for the specified color index.

ArgumentTypeDefaultDescription
colorIdInteger The index of the color to be converted to a hex string. For example, green would be FXRGB(0, 255,0). See the Colors appendix of the Abaqus GUI Toolkit User's Manual for details.


afxGetColorHexSpecFromName(colorName)

Returns the equivalent hex string for the specified color name.

ArgumentTypeDefaultDescription
colorNameString The name of the color to be converted to a hex string. For example, 'Red'. See the Colors appendix of the Abaqus GUI Toolkit User's Manual for details.


getCurrentContext()

Returns the current GUI context dictionary, which contains the following keys: mdbName, viewportName, objectPath, objectType, modelName, and moduleName. You can be notified of context changes by using the registerCurrentContext function.


getCurrentModuleGui()

Returns the current moduleGui object. You can call that object's getModuleName method to check its name.


getCursorPosition()

Returns a tuple of status,x,y,buttonState. The status (TRUE or FALSE) indicates the success of the call. The x and y values represent the position of the cursor in the window's coordinate system (origin is in the upper left, positive Y points downward). This method is defined in FXWindow, so it may be called on any object derived from FXWindow.


getDisplayedObjectType()

Returns the type of the object displayed in the current viewport. Possible return values are: PART, ASSEMBLY, ODB, XY_PLOT, SKETCH, or None.


getSeparator(parent, count)

Returns the nth (specified by the count argument) separator widget of the parent.

ArgumentTypeDefaultDescription
parentWidget The widget to be searched (children are not traversed).
countInt The number of the separator (e.g. specify 2 to get the second separator).


getWidgetFromText(parent, text)

Returns a widget whose label or tip text matches the specified text and is also a child of the specified widget.

ArgumentTypeDefaultDescription
parentWidget The widget at which the search begins (children are traversed too).
textString The text to be matched (must be an exact match).


highlight(entity)

Highlights the specified entity in the current viewport. Use the unhighlight method to remove the highlighting.

ArgumentTypeDefaultDescription
entityObject The entity to be highlighted.


openWithURL(url)

Displays the specified URL in a web browser. Returns the status of the call. This call will always open a new web browser. This method can be accessed via webBrowser.openWithURL from module uti. See also displayURL.

ArgumentTypeDefaultDescription
urlString The URL of the page to be displayed.


registerCurrentContext(callbackFunction)

Registers a query on the current context. The specified callback function will be invoked when the current viewport or displayed object changes. Use the getCurrentContext method to get the values of the current objects. Note that unregisterCurrentContext should be called with the same argument to unregister the query when it is no longer needed.

ArgumentTypeDefaultDescription
callbackFunctionFunction Function to be called when the current context changes.


registerPluginToolset()

Registers the plug-in toolset with the application.


objectPath.registerQuery(callbackFunction, callOnRegister=TRUE)

Registers a query on the object. The specified callback function will be invoked when the object changes. Note that unregisterQuery should be called with the same argument to unregister the query when it is no longer needed.

ArgumentTypeDefaultDescription
callbackFunctionFunction Function to be called when the object changes.
callOnRegisterBoolTRUEIf TRUE, the callback function will be called when the query is registered.


objectPath.registerInclusive(callbackFunction, callOnRegister=TRUE)

Registers a query on the object and its children. The specified callback function will be invoked when the object or its children change. Note that unregisterQuery should be called with the same argument to unregister the query when it is no longer needed.

ArgumentTypeDefaultDescription
callbackFunctionFunction Function to be called when the object or its children change.
callOnRegisterBoolTRUEIf TRUE, the callback function will be called when the query is registered.


removeExitCallback(callback)

Unregisters a callback function to be called when the application is about to exit. The function must have been previously registered using addExitCallback.

ArgumentTypeDefaultDescription
callbackFunction The function to be removed from the callback list.


sendCommand(command, writeToReplay=True, writeToJournal=False)

Sends a command string to the kernel.

ArgumentTypeDefaultDescription
commandString Command string.
writeToReplayBoolTrueIf True, the command will be written to the replay file.
writeToJournalBoolFalseIf True, the command will be written to the journal file.


setCurrentModel(modelName)

Sets the current model to the specified model name.

ArgumentTypeDefaultDescription
modelNameString The name of the model to be made current.


setSwitchModuleHook(callbackFunction)

Sets the function that will be called whenever a GUI module is switched into. When the user switches into a GUI module, the specified function will be called, passing it the name (shown in the Module combo box) of the new module. Note that the setSwitchModuleHook function does not take keyword arguments.

ArgumentTypeDefaultDescription
callbackFunctionFunction The function to be called when a GUI module is switched into. Note that you cannot issue a kernel command from within this function or it will cause the application to lock up.


shutdown()

Exits Abaqus/CAE. This is equivalent to selecting File->Exit.


switchModule(moduleName)

Switches into a GUI module.

ArgumentTypeDefaultDescription
moduleNameString Module to switch into.


unhighlight(entity)

Unhighlights the specified entity in the current viewport.

ArgumentTypeDefaultDescription
entityObject The entity to be unhighlighted.


unregisterCurrentContext(callbackFunction)

Unregisters a query on the current context. The specified callback function should be the same argument that was used to register the query.

ArgumentTypeDefaultDescription
callbackFunctionFunction Function to be called when the current context changes.


objectPath.unregisterQuery(callbackFunction)

Unregisters a query on the object. The specified callback function should be the same argument that was specified to register the query.

ArgumentTypeDefaultDescription
callbackFunctionFunction Function to be called when the object changes.