Utility and Viewο
Utility commands are used to do the following:
Create SymbolicConstant and Boolean objects.
Change the name of a key to a Repository object.
Control the use of deprecated commands.
Request input from the user.
Display status information.
Execute Python commands or functions.
Register a callback that will be invoked when certain Abaqus Scripting Interface commands are about to be executed.
Register a callback that will be invoked when certain Abaqus Scripting Interface objects are about to be deleted.
Upgrade Abaqus kernel or GUI scripts from one release of Abaqus to a later release.
View commands are used to transform three-dimensional views stored in Session and Viewport objects to the screen. (See Session object and Viewport object.)
Other Classesο
- class AbaqusBoolean(value)[source]ο
Bases:
int
The AbaqusBoolean object is used in a similar way to the SymbolicConstant object. If you pass an AbaqusBoolean object to the Python repr() function, the function returns the text without quotes. In effect, the text is the variable that, by convention, refers to the AbaqusBoolean object. An AbaqusBoolean object has a value of 0 or 1, and an AbaqusBoolean object can be tested in an if statement. You can use an AbaqusBoolean object as an argument to a method in place of 1 or 0. Conversely, you can pass a 0 or a 1 to an Abaqus Scripting Interface method that expects a Boolean argument, and the 0 or 1 will be coerced to the appropriate AbaqusBoolean value. There are only two possible values for an AbaqusBoolean object: 1 and 0. You can import both values from the symbolicConstants module or from the abaqus module. Abaqus Scripting Interface commands that expect an AbaqusBoolean object will also accept a Python bool (True, False), or a Python int (1, 0).
Note
This object can be accessed by:
from symbolicConstants import * from abaqusConstants import *
Note
The AbaqusBoolean method creates an AbaqusBoolean object.
Note
This function can be accessed by:
AbaqusBoolean
- Parameters:
value (
int
) β An Int specifying whether the AbaqusBoolean object will test true or false. Possible values are 0 and 1, which will create the AbaqusBoolean method OFF and ON, respectively.- Returns:
An AbaqusBoolean object.
- Return type:
Member Details:
- class BackwardCompatibility[source]ο
Bases:
object
The BackwardCompatibility object enables the user to control access to deprecated commands in the Abaqus Scripting Interface and to collect data on which deprecated commands have been used. This enables the user to check that no deprecated methods, members, or arguments have been used. Data are recorded on any deprecated members, methods, or arguments that are used. The BackwardCompatibility object has no constructor. The abaqus module and the odbAccess module each have a member named backwardCompatibility. By default, the value of the includeDeprecated member is ON, and Abaqus will execute a script containing deprecated commands with no indication that you should update the script. You can do either of the following to change the value of the includeDeprecated member and to determine which commands have been deprecated:
From the command line interface in Abaqus/CAE or from an Abaqus Scripting Interface script that is run from within Abaqus/CAE, use the following command:
backwardCompatibility.setValues(includeDeprecated=OFF)
From an Abaqus Scripting Interface script that is run using abaqus python at the system prompt, use the following two commands:
from odbAccess import * backwardCompatibility.setValues(includeDeprecated=OFF)
In addition, the BackwardCompatibility object provides tools to assist you in determining the deprecated commands that have been used. For example, to determine the deprecated commands used in the script createLug.py, use the following commands:
backwardCompatibility.resetDeprecatedMethodsUsed() backwardCompatibility.resetDeprecatedMembersUsed() backwardCompatibility.resetDeprecatedArgsUsed() execfile('createLug.py') print backwardCompatibility.getDeprecatedMethodsUsed() print backwardCompatibility.getDeprecatedMembersUsed() print backwardCompatibility.getDeprecatedArgsUsed()
Note
This object can be accessed by:
backwardCompatibility
Note
Member Details:
- getDeprecatedArgsUsed()[source]ο
This method returns a list of deprecated arguments used since the last call to resetDeprecatedArgsUsed.
- Returns:
A list of Strings.
- Return type:
list[str]
- getDeprecatedMethodsUsed()[source]ο
This method returns a list of deprecated methods used since the last call to resetDeprecatedMethodsUsed.
- Returns:
A list of Strings.
- Return type:
list[str]
-
includeDeprecated:
Union
[AbaqusBoolean
,bool
] = 1[source]ο A Boolean specifying whether deprecated members, methods, and arguments can be seen and used. Possible values are ON and OFF. The default value is ON.
-
reportDeprecated:
Union
[AbaqusBoolean
,bool
] = True[source]ο A Boolean specifying whether a warning is displayed after running a script that contains deprecated commands. The default value is True.
- setValues(includeDeprecated=1, reportDeprecated=True, showKeysInReport=False)[source]ο
This method modifies the BackwardCompatibility object.
- Parameters:
includeDeprecated (
Union
[AbaqusBoolean
,bool
], default:1
) β A Boolean specifying whether deprecated members, methods, and arguments can be seen and used. The default value is ON.reportDeprecated (
Union
[AbaqusBoolean
,bool
], default:True
) β A Boolean specifying whether a warning is displayed after running a script that contains deprecated commands. The default value is True.showKeysInReport (
Union
[AbaqusBoolean
,bool
], default:False
) β A Boolean specifying whether the keys and indices are included in the report that is displayed when reportDeprecated is True. The default value is False.
-
showKeysInReport:
Union
[AbaqusBoolean
,bool
] = False[source]ο A Boolean specifying whether the keys and indices are included in the report that is displayed when reportDeprecated is True. The default value is False.
- addImportCallback(moduleName, callback, userData='')[source]ο
This function defines a function to be called when a specified Abaqus/CAE module is imported. You cannot specify a custom module. For more information, see An example of a callback function.
Note
This function can be accessed by:
addImportCallback
Note
- Parameters:
moduleName (
str
) β A String specifying the name of a specified Abaqus/CAE module.callback (
str
) β A Python function to be called. The interface definition of the callback function is def functionName(moduleName, userData). moduleName is a String. userData is the object passed as the userData argument to the addImportCallback method.userData (
str
, default:''
) β Any Python object or None. This object is passed to the callback function.
- removeImportCallback(callback, userData)[source]ο
This function removes a callback added in addImportCallback.
Note
This function can be accessed by:
removeImportCallback
- Parameters:
- journalMethodCall(objectPath, methodName, args, kargs)[source]ο
This function may be used by a user-defined command to record itself in the Abaqus journal file. For example:
def setValues(self, **kargs): for arg,value in kargs.items(): setattr(arg, value) from abaqus import journalMethodCall objPath = '%s[%r]' % (self.reposPath, self.name) journalMethodCall(objPath, 'setValues', (), kargs)
Note
Your command should not call journalMethodCall if the command changes the mdb using built-in Abaqus Scripting Interface commands, because built-in commands are journaled by default. A command that changes the mdb customData is one example of a command that should call journalMethodCall.
Note
This function can be accessed by:
journalMethodCall
- Parameters:
objectPath (
str
) β A String specifying the path to the object.methodName (
str
) β A String specifying the name of the method.args (
tuple
) β A sequence specifying the positional arguments to be written to the journal file.kargs (
str
) β A Python dict object specifying the keyword arguments to be written to the journal file.
- deleteObjectCallback(callback, path, userData=None, includeChildren=False)[source]ο
This method adds a callback function that will be invoked when the specified Abaqus Scripting Interface objects are about to be deleted. The callback is invoked only when the object is deleted using the Python statement del object. The callback is not invoked when the object is deleted using an Abaqus Scripting Interface command such as mdb.models[name].parts[name].deleteFeature().
Note
This function can be accessed by:
deleteObjectCallback.addCallback
Note
- Parameters:
callback (
str
) β A Python function to be called when an object matching the specified path is about to be deleted. The interface definition of the callback function is def functionName(objectPath, userData) where objectPath is the path to the object about to be deleted. userData is the object passed as the userData argument to the addCallback method.path (
str
) β A String specifying the path to an object or the SymbolicConstant ANY. You can include wildcards in the path to specify a pattern to be matched. Examples of valid paths are path=βmdb.models[*]β path=βmdb.models[βAxle*β].parts[*]β, and path=βmdb.models[*].materials[*]βuserData (
Optional
[str
], default:None
) β Any type of data. This data will be passed to the callback function. The default value is None.includeChildren (
Union
[AbaqusBoolean
,bool
], default:False
) β A Boolean specifying that the callback should be called if an object owned by the object specified by the path argument is about to be deleted. The default value is False.
- addCallback(caller, methodName, callback, userData=None, callAfter=0)[source]ο
This method adds a callback function that will be invoked when certain Abaqus/CAE commands are about to be executed.
Note
This function can be accessed by:
methodCallback.addCallback
Note
- Parameters:
caller (
str
) β An object or type object specifying which object will trigger the callback function to be invoked or the Symbolic Constant ALL_TYPES.methodName (
str
) β A String specifying the name of the method on the caller that will trigger the callback function to be invoked or the Symbolic Constant ALL_METHODS.callback (
str
) β A Python function to be called when a command matching the specified caller and method name is about to be executed. The interface definition of the callback function is def functionName(callingMethod, args, keywordArgs, userData) where callingMethod is the method that called this function. args is the sequence of non-keyword arguments that was passed to the calling method. keywordArgs is the dictionary of keyword arguments that was passed to the calling method. userData is the object passed as the userData argument to the addCallback method.userData (
Optional
[str
], default:None
) β Any type of data. This data will be passed to the callback function. The default value is None.callAfter (
Union
[AbaqusBoolean
,bool
], default:0
) β A Boolean specifying that the callback should be called after the method has executed (instead of before the method is called). The default value is False, which indicates that the callback should be called before the method has executed. If callAfter = True, you can also access the return value of the command from within the callback by including the following statement returnValue = getMethodReturnValue() The getMethodReturnValue function is in the global namespace of the callback function.
- removeCallback(caller, methodName, callback, userData=None)[source]ο
This method removes a callback added by the addCallback method. To successfully remove a callback, all arguments must exactly match those used when the callback was added.
Note
This function can be accessed by:
methodCallback.removeCallback
Note
- Parameters:
caller (
str
) β An object or type object specifying which object will trigger the callback function to be invoked or the Symbolic Constant ALL_TYPES.methodName (
str
) β A String specifying the name of the method on the caller that will trigger the callback function to be invoked or the Symbolic Constant ALL_METHODS.callback (
str
) β A Python function to be called when a command matching the specified caller and method name is about to be executed. The interface definition of the callback function is def functionName(callingMethod, args, keywordArgs, userData) where callingMethod is the method that called this function. args is the sequence of nonkeyword arguments that was passed to the calling method. keywordArgs is the dictionary of keyword arguments that was passed to the calling method. userData is the object passed as the userData argument to the removeCallback method.userData (
Optional
[str
], default:None
) β Any type of data. This data will be passed to the callback function. The default value is None.
- class Repository[source]ο
Bases:
Dict
Repositories are containers that store a particular type of object; for example, the steps repository contains all the steps defined in the model. An Abaqus Scripting Interface Repository maps a key to a value. The key is usually a String, and the value is any Python object, usually an Abaqus object. A repository is similar to a Python dictionary; however, only a constructor can add an object to a repository. In addition, all of the objects in a repository are of the same base type. For more information, see Repositories. A Repository has no constructor. Abaqus creates empty repositories when you import a module. For example, Abaqus creates an empty parts repository when you import the part module. The following methods of the Repository object are standard Python dictionary methods and are not described here:
The Repository object is derived from the dict object. - has_key - items - keys - values - [changeKey(β¦)](https://help.3ds.com/2022/english/DSSIMULIA_Established/SIMACAEKERRefMap/simaker-c-utlrepositorypyc.htm?ContextScope=all#simaker-utlrepositorychangekeypyc)
Note
Member Details:
- milestone(message: str)[source]ο
- milestone(message: str, percent: int)
- milestone(message: str, object: str)
- milestone(*args, **kwargs)
- class SymbolicConstant(text)[source]ο
Bases:
str
The SymbolicConstant object represents a string in a way that can be stored in a replay file and used as an argument to Abaqus Scripting Interface methods and functions. By convention the string representation of the SymbolicConstant object is the same as its variable name. If you pass a SymbolicConstant object to the Python repr() function, the function returns the text without quotes. In effect, the text is the variable that, by convention, refers to the SymbolicConstant object. Two SymbolicConstant objects with the same text are the same Python object, although you can assign them to different variables. All of the SymbolicConstant objects that are required in Abaqus Scripting Interface methods are defined in the abaqusConstants module. Some SymbolicConstant objects and the SymbolicConstant constructor are defined in the abaqus module. The SymbolicConstant constructor is also defined in the symbolicConstants module.
Note
This object can be accessed by:
from symbolicConstants import * from abaqusConstants import *
Note
The SymbolicConstant method creates a SymbolicConstant object.
Note
This function can be accessed by:
SymbolicConstant
- Parameters:
text (
str
) β A String specifying the text of the SymbolicConstant object. The String must contain only capital letters, digits, or underscores and must not start with a digit.- Returns:
A SymbolicConstant object.
- Return type:
Member Details:
- class abaqusConstants(text)[source]ο
Bases:
SymbolicConstant
,Enum
The SymbolicConstant method creates a SymbolicConstant object.
Note
This function can be accessed by:
SymbolicConstant
- Parameters:
text (
str
) β A String specifying the text of the SymbolicConstant object. The String must contain only capital letters, digits, or underscores and must not start with a digit.- Returns:
A SymbolicConstant object.
- Return type:
Member Details: