5.3 ABAQUS Scripting Interface data types

The standard Python data types described in Python data types, Section 4.5.2, include integers, floats, strings, and sequences. The ABAQUS Scripting Interface adds over 500 additional data types. The following sections describe the most common ABAQUS Scripting Interface data types:


5.3.1 SymbolicConstants

Some arguments require that you provide a SymbolicConstant. SymbolicConstants are defined by the ABAQUS Scripting Interface and are written in all capital letters. If your script uses a SymbolicConstant defined by the ABAQUS Scripting Interface, you must import the SymbolicConstant with the following statement before you refer to it:

from abaqusConstants import *

When an argument to a command is a SymbolicConstant, the description in the ABAQUS Scripting Reference Manual lists all its possible values. For example, when you are printing an image, the image can be rendered in one of the following formats: BLACK_AND_WHITE, GREYSCALE, or COLOR.

Similarly, a data member can be a SymbolicConstant. For example, the type member of the Elastic object can be one of the following SymbolicConstants: ISOTROPIC, ORTHOTROPIC, ANISOTROPIC, ENGINEERING_CONSTANTS, LAMINA, TRACTION, or COUPLED_TRACTION.

If the SymbolicConstants provided by the ABAQUS Scripting Interface do not meet your needs, you can create your own SymbolicConstants using the SymbolicConstant constructor. For more information, see SymbolicConstant object, Section 47.1 of the ABAQUS Scripting Reference Manual.


5.3.2 Booleans

Booleans are closely related to SymbolicConstants. In most cases, a Boolean can be either ON or OFF; however, in some cases a Boolean can be either TRUE or FALSE. The test value of the Boolean ON and the Boolean TRUE is 1. Similarly, the test value of the Boolean OFF and the Boolean FALSE is 0.

For example, noPartsInputFile is a member of a Model object that indicates whether the input file will be written with parts and assemblies. In addition, noPartsInputFile is an argument to the setValues method that modifies a Model object. Both the noPartsInputFile member and the noPartsInputFile argument are Booleans.

The following statements show how you can test the value of a Boolean member:

newModel = mdb.ModelFromInputFile(name='beamTutorial', 
    inputFileName='Deform')
if (newModel.noPartsInputFile):
    print 'Input file will be written 
        without parts and assemblies. '
else:
    print 'Input file will be written 
        with parts and assemblies.'

By default, a Boolean in the ABAQUS Scripting Interface has a value of either ON or OFF. You can create your own Boolean with a value of either ON, OFF, TRUE, or FALSE using the Boolean constructor. For more information, see Boolean object, Section 47.2 of the ABAQUS Scripting Reference Manual.


5.3.3 Repositories

Repositories are containers that store a particular type of object; for example, the steps repository contains all the steps defined in the model. A repository maps to a set of information and is similar to a Python dictionary; for more information, see Using dictionaries, Section 4.6.2. However, only a constructor can add an object to a repository. In addition, all the objects in a repository are of the same type. For example, the following repository contains all the models in the model database:

mdb.models
In turn, the following repository contains all the parts in the model Model-1:
mdb.models['Model-1'].parts

As with dictionaries, you can refer to an object in a repository using its key. The key is typically the name you provided in the constructor command when the object was created. For example, the Viewport constructor creates a new Viewport object in the viewports repository.

session.Viewport(name='Side view', 
    origin = (10,10), width=50, height=50)
The key to this new Viewport object in the viewports repository is Side view. You use this key to access this particular Viewport object. For example,
session.viewports['Side view'].viewportAnnotationOptions.\
    setValues(legend=OFF, title=OFF)
You can make your scripts more readable by assigning a variable to an object in a repository. For example, you could rewrite the previous statement after assigning the Viewport object to the variable myViewport:
myViewport = session.viewports['Side view']
myViewport.viewportAnnotationOptions.setValues(
    legend=OFF, title=OFF)
In general, if the user can create the object, its repository key is a string. In some cases ABAQUS/CAE creates an object, and the key can be a string, an integer, or a SymbolicConstant.

As with dictionaries, you can use the keys() method to access the repository keys.

>>> session.Viewport(name='Side view')
>>> session.Viewport(name='Top view')
>>> session.Viewport(name='Front view')
>>> for key in session.viewports.keys():
...     print key
Front view
Top view
Side view
You can use the keys()[i] method to access an individual key; however, most repositories are not ordered, and this is not recommended.

You can use the changeKey() method to change the name of a key in a repository. For example,

myPart = mdb.models['Model-1'].Part(name='housing', 
    dimensionality=THREE_D, type=DEFORMABLE_BODY)
mdb.models['Model-1'].parts.changeKey(fromName='housing',
    toName='form')