The Abaqus Scripting Interface and members

An object has members as well as methods. A member can be thought of as a property of an object. For example, width is a member of the Viewport object. The following statements show how you access a member of an object:

>>> myWidth = session.viewports['myViewport'].width
>>> print 'Viewport width =', myWidth Viewport width = 100.0
The standard Python statement object.__members__ lists all the members of an object. For example, the following statement lists all the members of a Viewport object:
session.viewports['myViewport'].__members__
The values of members are specific to each instance of the object. For example, the value of the width member of a Viewport object is specific to each viewport.

Members of an Abaqus object are read-only; consequently, you cannot change their value with a simple assignment statement. You use the setValues() method to change the value of a member. For example, the setValues() statement in the following script changes the thickness of a shell section:

>>> import section 
>>> shellSection = mdb.models['Model-1'].HomogeneousShellSection(
        name='Steel Shell', thickness=1.0, material='Steel') 
>>> print 'Original shell section thickness = ' \ 
        , shellSection.thickness
Original shell section thickness =  1.0 
>>> shellSection.setValues(thickness=2.0)
>>> print 'Final shell section thickness = ' \
        , shellSection.thickness
Final shell section thickness =  2.0

You cannot use assignment to change the value of the Shell object.

>>> myShell.thickness = 2.0  
TypeError: readonly Attribute 

The following statements illustrate the use of constructors, methods, and members:

>>> # Create a Section object 
>>> mySection = mdb.models['Model-1'].HomogeneousSolidSection(
        name='solidSteel', material='Steel', thickness=1.0)  
>>> # Display the type of the object 
>>> print 'Section type = ', type(mySection) 
Section type = <type 'HomogeneousSolidSection'> 
>>> # List the members of the object
>>> print 'Members of the section are:' , mySection.__members__ 
Members of the section are: ['category', 'dimension', 
'layout', 'material', 'name',
'thickness']  
>>> # List the methods of the object 
>>> print 'Methods of the section are: ', mySection.__methods__ 
Methods of the section are:  ['setValues']
>>> # Print the value of each member in a nice format 
>>> for member in mySection.__members__:
    ...     
    print 'mySection.%s = %s' % (member, 
        getattr(mySection, member))
mySection.category = SOLID  
mySection.dimension = THREE_DIM  
mySection.layout = HOMOGENEOUS  
mySection.material = Steel  
mySection.name = solidSteel  
mySection.thickness = 1.0

You use the Access description provided with each object in the Abaqus Scripting Reference Guide to determine how you access the object. You append a method or member to this description when you are writing a script. Similarly, you use the Path description provided with each constructor in the Abaqus Scripting Reference Guide to determine the path to the constructor.