Repositories

Repositories are containers that hold objects that are keyed by strings. It may be convenient to store your custom kernel objects in repositories, in the same way that Abaqus/CAE part objects are stored in the Parts repository.

The customData object is an instance of a RepositorySupport class, which provides a Repository method that allows you to create a repository as an attribute of the instance. For more information, see RepositorySupport. The arguments to the Repository method are the name of the repository and a constructor or a sequence of constructors. Those constructors must have name as their first argument, and the infrastructure will automatically assign that value to a member called name. Instances of these constructors will be stored in the repository. For more information, see Repository object.

Since repositories are designed to notify the GUI when their contents change, the objects placed inside them should be derived from either CommandRegister or RepositorySupport to extend this capability to its fullest.

The Abaqus Scripting Interface uses the following conventions:

  • The name of a repository is a plural noun with all lowercase letters.

  • A constructor is a capitalized noun (or a combination of capitalized nouns and adjectives).

  • The first argument to the constructor must be name.

For example, the Part constructor creates a part object and stores it in the parts repository. You can access the part object from the repository using the same name argument that you passed in with the Part constructor. In some cases, more than one constructor can create instances that are stored in the same repository. For example, the HomogeneousSolidSection and the HomogeneousShellSection constructors both create section objects that are stored in the sections repository. For more information, see Abstract base type. For example, the following script creates a blocks repository, and the Block constructor creates a block object in the blocks repository:

from customKernel import CommandRegister
class Block(CommandRegister): 
    def __init__(self, name): 
        CommandRegister.__init__(self)

mdb.customData.Repository('blocks', Block) 
block = mdb.customData.Block(name='Block-1')
print mdb.customData.blocks['Block-1'].name Block-1