This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
OdbAssembly.py
331 lines (282 loc) · 12 KB
/
OdbAssembly.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
from abaqusConstants import *
from .AnalyticSurface import AnalyticSurface
from .OdbAssemblyBase import OdbAssemblyBase
from .OdbDatumCsys import OdbDatumCsys
from .OdbInstance import OdbInstance
from .OdbMeshNode import OdbMeshNode
from .OdbPart import OdbPart
from .OdbRigidBody import OdbRigidBody
from .OdbSet import OdbSet
class OdbAssembly(OdbAssemblyBase):
def DatumCsysByThreePoints(
self,
name: str,
coordSysType: SymbolicConstant,
origin: tuple,
point1: tuple,
point2: tuple,
):
"""This method creates an OdbDatumCsys object using three points. A datum coordinate system
created with this method results in a fixed system.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[name].rootAssembly.DatumCsysByThreePoints
Parameters
----------
name
A String specifying the repository key.
coordSysType
A SymbolicConstant specifying the type of coordinate system. Possible values are
CARTESIAN, CYLINDRICAL, and SPHERICAL.
origin
A sequence of Floats specifying the coordinates of the origin of the datum coordinate
system.
point1
A sequence of Floats specifying the coordinates of a point on the local 1- or rr-axis.
point2
A sequence of Floats specifying the coordinates of a point in the 1–2 or rr–θθ plane.
Returns
-------
An OdbDatumCsys object.
"""
self.datumCsyses[name] = datumCsys = OdbDatumCsys()
return datumCsys
def DatumCsysByThreeNodes(
self,
name: str,
coordSysType: SymbolicConstant,
origin: OdbMeshNode,
point1: OdbMeshNode,
point2: OdbMeshNode,
):
"""This method creates an OdbDatumCsys object using the coordinates of three OdbMeshNode
objects. A datum coordinate system created with this method results in a system that
follows the position of the three nodes. Results, such as those for displacement, are
resolved into the orientation of the datum coordinate system without regard to the
position of its origin. The last three arguments are given in the form of an OdbMeshNode
object.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[name].rootAssembly.DatumCsysByThreeNodes
Parameters
----------
name
A String specifying the repository key.
coordSysType
A SymbolicConstant specifying the type of coordinate system. Possible values are
CARTESIAN, CYLINDRICAL, and SPHERICAL.
origin
An OdbMeshNode object specifying a node at the origin of the datum coordinate system.
point1
An OdbMeshNode object specifying a node on the local 1- or rr-axis.
point2
An OdbMeshNode object specifying a node in the 1–2 or rr–θθ plane.
Returns
-------
An OdbDatumCsys object.
"""
self.datumCsyses[name] = datumCsys = OdbDatumCsys()
return datumCsys
def DatumCsysByThreeCircNodes(
self,
name: str,
coordSysType: SymbolicConstant,
node1Arc: OdbMeshNode,
node2Arc: OdbMeshNode,
node3Arc: OdbMeshNode,
):
"""This method is convenient to use where there are no nodes along the axis of a hollow
cylinder or at the center of a hollow sphere. The three nodes that you provide as
arguments determine a circle in space. The center of the circle is the origin of the
datum coordinate system. The normal to the circle is parallel to the zz-axis of a
cylindrical coordinate system or to the ϕϕ-axis of a spherical coordinate system. The
line from the origin to the first node defines the rr-axis.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[name].rootAssembly.DatumCsysByThreeCircNodes
Parameters
----------
name
A String specifying the repository key.
coordSysType
A SymbolicConstant specifying the type of coordinate system. Possible values are
CARTESIAN, CYLINDRICAL, and SPHERICAL.
node1Arc
An OdbMeshNode object that lies on the circular arc.
node2Arc
An OdbMeshNode object that lies on the circular arc.
node3Arc
An OdbMeshNode object that lies on the circular arc.
Returns
-------
An OdbDatumCsys object.
"""
self.datumCsyses[name] = datumCsys = OdbDatumCsys()
return datumCsys
def DatumCsysBy6dofNode(
self, name: str, coordSysType: SymbolicConstant, origin: OdbMeshNode
):
"""A datum coordinate system created with this method results in a system that follows the
position of a node. The node location defines the origin of the datum coordinate system.
The rotational displacement (UR1, UR2, UR3) of the node defines the orientation of the
coordinate system axes. Results, such as those for displacement, are resolved into the
orientation of the datum coordinate system without regard to the position of its origin.
The last argument is given in the form of an OdbMeshNode object.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[name].rootAssembly.DatumCsysBy6dofNode
Parameters
----------
name
A String specifying the repository key.
coordSysType
A SymbolicConstant specifying the type of coordinate system. Possible values are
CARTESIAN, CYLINDRICAL, and SPHERICAL.
origin
An OdbMeshNode object specifying the origin of the datum coordinate system.
Returns
-------
An OdbDatumCsys object.
"""
self.datumCsyses[name] = datumCsys = OdbDatumCsys()
return datumCsys
def DatumCsys(self, name: str, datumCsys: OdbDatumCsys):
"""This method copies oneOdbDatumCsys object to a new OdbDatumCsys object.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[name].rootAssembly.DatumCsys
Parameters
----------
name
A String specifying the repository key.
datumCsys
An OdbDatumCsys object specifying the object to be copied.
Returns
-------
An OdbDatumCsys object.
"""
self.datumCsyses[name] = datumCsys = OdbDatumCsys()
return datumCsys
def Instance(
self, name: str, object: OdbPart, localCoordSystem: tuple = ()
) -> OdbInstance:
"""This method creates an OdbInstance object from an OdbPart object.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[*name*].rootAssembly.Instance
Parameters
----------
name
A String specifying the instance name.
object
An OdbPart object.
localCoordSystem
A sequence of sequences of three Floats specifying the rotation and translation of the
part instance in the global Cartesian coordinate system. The first three sequences
specify the new local coordinate system with its center at the origin.The first sequence
specifies a point on the 1-axis.The second sequence specifies a point on the 2-axis.The
third sequence specifies a point on the 3-axis.The fourth sequence specifies the
translation of the local coordinate system from the origin to its intended location.For
example, the following sequence moves a part 10 units in the *X*-direction with no
rotation:`localCoordSystem = ((1, 0, 0), (0, 1, 0), (0, 0, 1), (10, 0, 0))`The following
sequence moves a part 5 units in the *X*-direction with rotation:
`localCoordSystem = ((0, 1, 0), (1, 0, 0), (0, 0, 1), (5, 0, 0))`transforms a part
containing the two points`Pt1= (1,0,0) Pt2= (2,0,0)` to `Pt1 = (0, 6, 0) Pt2 = (0, 7, 0)`
Returns
-------
An OdbInstance object.
"""
self.instances[name] = odbInstance = OdbInstance(name, object, localCoordSystem)
return odbInstance
def OdbRigidBody(
self,
referenceNode: OdbSet,
position: SymbolicConstant = INPUT,
isothermal: Boolean = ON,
elements: OdbSet = OdbSet("set", tuple[OdbMeshNode]()),
tieNodes: OdbSet = OdbSet("set", tuple[OdbMeshNode]()),
pinNodes: OdbSet = OdbSet("set", tuple[OdbMeshNode]()),
analyticSurface: AnalyticSurface = AnalyticSurface(),
) -> OdbRigidBody:
"""This method creates a OdbRigidBody object.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[*name*].rootAssembly.instances[*name*].RigidBody
session.odbs[*name*].rootAssembly.RigidBody
Parameters
----------
referenceNode
An OdbSet object specifying the reference node set associated with the rigid body.
position
A SymbolicConstant specifying the specific location of the OdbRigidBody reference node
relative to the rest of the rigid body. Possible values are INPUT and CENTER_OF_MASS.
The default value is INPUT.
isothermal
A Boolean specifying specify whether the OdbRigidBody can have temperature gradients or
be isothermal. This is used only for fully coupled thermal-stress analysis The default
value is ON.
elements
An OdbSet object specifying the element set whose motion is governed by the motion of
rigid body reference node.
tieNodes
An OdbSet object specifying the node set which have both translational and rotational
degrees of freedom associated with the rigid body.
pinNodes
An OdbSet object specifying the node set which have only translational degrees of
freedom associated with the rigid body.
analyticSurface
An AnalyticSurface object specifying the analytic surface whose motion is governed by
the motion of rigid body reference node.
Returns
-------
An OdbRigidBody object.
"""
odbRigidBody = OdbRigidBody(
referenceNode,
position,
isothermal,
elements,
tieNodes,
pinNodes,
analyticSurface,
)
self.rigidBodies.append(odbRigidBody)
return odbRigidBody
def NodeSet(self, name: str, nodes: tuple[OdbMeshNode]) -> OdbSet:
"""This method creates a node set from an array of OdbMeshNode objects (for part
instance-level sets) or from a sequence of arrays of OdbMeshNode objects (for
assembly-level sets).
Notes
-----
This function can be accessed by:
.. code-block:: python
session.odbs[*name*].parts[*name*].NodeSet
session.odbs[*name*].rootAssembly.instances[*name*].NodeSet
session.odbs[*name*].rootAssembly.NodeSet
Parameters
----------
name
A String specifying the name of the set and the repository key.
nodes
A sequence of OdbMeshNode objects. For example, for a part:`nodes=part1.nodes[1:5]`For
an assembly:`nodes=(instance1.nodes[6:7], instance2.nodes[1:5])`
Returns
-------
An OdbSet object.
"""
self.nodeSets[name] = odbSet = OdbSet(name, nodes)
return odbSet