Custom Kernel

The customKernel module augments the mdb, odb, and session objects with an object called customData. The customData object can contain custom data that you created using standard Python objects; for example, dictionaries, strings, numbers, and classes. In addition, the customData object can contain objects that you created using the classes described in this section.

All objects that you create under the mdb.customData and odb[odbName].customData object will be stored in the Abaqus/CAE model and output database, respectively, when you save the database; all objects that you create under the session.customData object will be lost when you exit Abaqus/CAE.

The customData object is an instance of the RepositorySupport class; for more information, see RepositorySupport. The classes described in this section register with the GUI infrastructure when you create the class. As a result, if you write a custom GUI script, you can query these objects from the GUI, and you can also be notified when the contents of these objects change so you can update the GUI accordingly. For more information, see Extending the Abaqus Scripting Interface and Accessing kernel data from the GUI.

Other Classes

class CommandRegister[source]

Bases: object

This class allows you to derive a general class that can be queried from the GUI and is capable of notifying the GUI when the contents of the class change.

Note

This object can be accessed by:

import customKernel

This class allows you to derive a general class that can be queried from the GUI and is capable of notifying the GUI when the contents of the class change.

Note

This function can be accessed by:

customKernel.CommandRegister
Returns:

A CommandRegister object.

Return type:

CommandRegister

Member Details:

class RegisteredDictionary[source]

Bases: CommandRegister, dict

This class allows you to create a dictionary that can be queried from the GUI and is capable of notifying the GUI when the contents of the dictionary change. The keys to a RegisteredDictionary must be either strings or integers. The RegisteredDictionary object is derived from the CommandRegister object.

Note

This object can be accessed by:

import customKernel

This method creates a RegisteredDictionary object.

Note

This function can be accessed by:

customKernel.RegisteredDictionary
Returns:

A RegisteredDictionary object.

Return type:

RegisteredDictionary

Member Details:

Methods()[source]

The RegisteredDictionary object supports the same methods as a Python dictionary.

In addition, the RegisteredDictionary object supports the changeKey method.

changeKey(fromName, toName)[source]

This method changes the name of a key in the dictionary.

Parameters:
  • fromName (str) – A String or an integer specifying the name of the key to be changed.

  • toName (str) – A String or an integer specifying the new name for the key.

class RegisteredList[source]

Bases: CommandRegister, list

This class allows you to create a list that can be queried from the GUI and is capable of notifying the GUI when the contents of the list change. The RegisteredList object is derived from the CommandRegister object.

Note

This object can be accessed by:

import customKernel

This method creates a RegisteredList object.

Note

This function can be accessed by:

customKernel.RegisteredList
Returns:

A RegisteredList object.

Return type:

RegisteredList

Member Details:

Methods()[source]

The RegisteredList object supports the same methods as a standard Python list object.

class RegisteredTuple(tuple)[source]

Bases: CommandRegister, tuple

This class allows you to create a tuple that can be queried from the GUI and is capable of notifying the GUI when the contents of any of the tuple’s members change. The RegisteredTuple object is derived from the CommandRegister object.

Note

This object can be accessed by:

import customKernel

This method creates a RegisteredTuple object.

Note

This function can be accessed by:

customKernel.RegisteredTuple
Parameters:

tuple (tuple) – A tuple of objects. These objects must be derived from the CommandRegister class.

Returns:

A RegisteredTuple object.

Return type:

RegisteredTuple

Member Details:

Methods()[source]

The RegisteredTuple object supports the same methods as a standard Python list object.

class RepositorySupport[source]

Bases: CommandRegister

The class from which you can derive your own classes that are designed to contain custom repositories. Instances of this class can be queried from the GUI and are capable of notifying the GUI when the contents of the instance change. The RepositorySupport object is derived from the CommandRegister object.

Note

This object can be accessed by:

import customKernel
mdb.customData
session.customData
session.odbs[name].customData

This method creates a RepositorySupport object.

Note

This function can be accessed by:

customKernel.RepositorySupport
Returns:

A RepositorySupport object.

Return type:

RepositorySupport

Member Details:

Repository(name, constructors)[source]

This method installs a repository on the class. The repository is an instance of a RegisteredDictionary class. Refer to RegisteredDictionary for details on its methods. The objects stored in the repository are assumed to have an attribute called name that stores the key used to access the object in the repository. The name attribute will be modified by the changeKey method.

Parameters:
  • name (str) – A String specifying the name of the repository.

  • constructors (Union[Callable, list[Callable]]) – A constructor or sequence of constructors specifying which classes will store their instances in the repository.