This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
KeywordBlock.py
131 lines (112 loc) · 6.1 KB
/
KeywordBlock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from abaqusConstants import *
class KeywordBlock:
"""The KeywordBlock object contains a representation of its model in the Abaqus input file
format. You may edit the contents of the KeywordBlock to add solver functionality that
is not supported by Abaqus/CAE. As a general rule, edits to the KeywordBlock object
should be made as the last step prior to writing the actual Abaqus input file, thus
avoiding possible conflicts with changes made using other MDB commands. The KeywordBlock
object has no constructor. A KeywordBlock object is created when you create a model
object. A model object contains only one KeywordBlock object.
Attributes
----------
edited: Boolean
A Boolean specifying whether the Keywords Editor has been used to change the model.
lastSynchCount: float
A Float specifying the value of the counter associated with the :py:class:`~abaqus.abaqus.Mdb` object at the most
recent synchronization.
sieBlocks: tuple
A tuple of Strings specifying a sequence of Strings that is identical to the information
written to the Abaqus input file. Each String in the sequence represents an Abaqus input
file keyword along with the parameters and data lines associated with the keyword. A
String can also be a comment in the input file. You initialize this data member by
calling synchVersions. After you initialize the data member, you use calls to replace
and insert to record your edits in the correct location. If the last call to
synchVersions used the argument **storeNodesAndElements=False**, the entry for the
keywords NODE and ELEMENT will contain only the keyword and its parameters, not the data
lines.
Notes
-----
This object can be accessed by:
mdb.models[name].keywordBlock
"""
# A Boolean specifying whether the Keywords Editor has been used to change the model.
edited: Boolean = OFF
# A Float specifying the value of the counter associated with the Mdb object at the most
# recent synchronization.
lastSynchCount: float = None
# A tuple of Strings specifying a sequence of Strings that is identical to the information
# written to the Abaqus input file. Each String in the sequence represents an Abaqus input
# file keyword along with the parameters and data lines associated with the keyword. A
# String can also be a comment in the input file. You initialize this data member by
# calling synchVersions. After you initialize the data member, you use calls to replace
# and insert to record your edits in the correct location. If the last call to
# synchVersions used the argument *storeNodesAndElements*=False, the entry for the
# keywords NODE and ELEMENT will contain only the keyword and its parameters, not the data
# lines.
sieBlocks: tuple = ()
def setValues(self, edited: Boolean = OFF):
"""This method modifies the KeywordBlock object.
Parameters
----------
edited
A Boolean specifying whether this objects *sieBlocks* member has been edited. Setting
edited=False will set the *sieBlocks* member to an empty tuple, thereby discarding all
previous edits.
"""
pass
def insert(self, position: int, text: str):
"""This method inserts a String at a specified position in the *sieBlocks* member.
Parameters
----------
position
An Int specifying the position in the *sieBlocks* member after which the new string will
be inserted.
text
A String specifying the text to be inserted. The text represents an Abaqus input file
keyword and its associated data
Raises
------
IndexError.
"""
pass
def replace(self, position: int, text: str):
"""This method replaces a String at a specified position in the *sieBlocks* member.
Parameters
----------
position
An Int specifying the position of the String to be replaced in the *sieBlocks* member.
text
A String specifying the text to be replaced. The text represents an Abaqus input file
keyword and its associated data.
Raises
------
IndexError.
"""
pass
def synchVersions(self, storeNodesAndElements: Boolean):
"""This method synchronizes, or merges, the edits made in this object with those made in
the model using other scripting commands or the user interface. The synchVersions method
updates the *sieBlocks* member. The *sieBlocks* member is empty prior to the first call
to synchVersions. As a side effect, synchVersions sets *lastSynchCount* to the current
value of the counter associated with the Mdb object, which is used to determine if
synchronization is necessary.
Parameters
----------
storeNodesAndElements
A Boolean specifying whether the nodal coordinates and element connectivities (i.e. the
data lines for the *NODE and *ELEMENT keyword blocks) are to be stored in the
*sieBlocks* member. All other keywords and their data lines are always stored. The
default value is True. If *storeNodesAndElements* is True, the size of the keywordBlock
data will be similar to that of the input file. Since the KeywordBlock is stored in the
Abaqus/CAE database, this will result in a larger database. It will also result in a
slower execution of the synchVersions command. If *storeNodesAndElements* is False, the
data lines are not stored in *sieBlocks*. Consequently, only set
*storeNodesAndElements*=True if you wish to make changes to the *NODE or *ELEMENT data
lines themselves. If your task is limited to reading nodal coordinates and element
connectivities (i.e. not editing this information) then it is generally better to access
this information from other parts of the Mdb.
Raises
------
IndexError.
"""
pass