• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

haiiliin / abqpy / 5910646359

19 Aug 2023 09:25AM UTC coverage: 83.152% (-0.1%) from 83.3%
5910646359

push

github

web-flow
[typing] Fix wrong mypy typing annotations (backport #4879) (#4880)

* [typing] Fix wrong mypy typing annotations (#4879)

* Fix mypy abqpy issues

* Mypy typings

* Update typing annotations for SymbolicConstants

* Fixing typings

* Add future annotations

* Use list/dict/tuple instead of List/Dict/Tuple

* Fix Optional typings

* Add future annotations

* Update xyPlot.py

* Update .pre-commit-config.yaml

* Fix list typings for Python 3.7/3.8

* Fixing more typings

* Fix more typings

* Update conf.py

* Update .pre-commit-config.yaml

* Revert "Update conf.py"

This reverts commit e8449ae0c.

* Update conf.py

* Revert "Update conf.py"

This reverts commit 3be44d0a5.

* Docs Not -W

(cherry picked from commit d7be4b472)

# Conflicts:
#	src/abaqus/BasicGeometry/Cell.py
#	src/abaqus/BasicGeometry/CellArray.py
#	src/abaqus/BasicGeometry/Face.py
#	src/abaqus/BasicGeometry/FaceArray.py
#	src/abaqus/BoundaryCondition/BoundaryConditionModel.py
#	src/abaqus/BoundaryCondition/SubmodelBC.py
#	src/abaqus/Datum/DatumCsys.py
#	src/abaqus/DisplayGroup/LeafFromConstraintNames.py
#	src/abaqus/EngineeringFeature/DataImperfection.py
#	src/abaqus/EngineeringFeature/EngineeringFeature.py
#	src/abaqus/EngineeringFeature/EngineeringFeatureBase.py
#	src/abaqus/EngineeringFeature/FileImperfection.py
#	src/abaqus/EngineeringFeature/InputImperfection.py
#	src/abaqus/FieldReport/FieldReportSession.py
#	src/abaqus/FieldReport/writeFieldReport.py
#	src/abaqus/Interaction/ContactExp.py
#	src/abaqus/Interaction/ContactStd.py
#	src/abaqus/Interaction/ExpInitialization.py
#	src/abaqus/Interaction/FluidInflatorProperty.py
#	src/abaqus/Interaction/FluidInflatorState.py
#	src/abaqus/Interaction/InteractionContactInitializationModel.py
#	src/abaqus/Interaction/InteractionModel.py
#	src/abaqus/Interaction/InteractionPropertyModel.py
#	src/abaqus/Interaction/SurfaceCrushTriggerAssignment.py
#... (continued)

3258 of 3258 new or added lines in 713 files covered. (100.0%)

24089 of 28970 relevant lines covered (83.15%)

0.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.72
/src/abaqus/BasicGeometry/FaceArray.py
1
from __future__ import annotations
1✔
2

3
from typing import List, Sequence, Union, overload
1✔
4

5
from abqpy.decorators import abaqus_class_doc, abaqus_method_doc
1✔
6

7
from ..UtilityAndView.abaqusConstants import Boolean
1✔
8
from .Face import Face
1✔
9

10

11
@abaqus_class_doc
1✔
12
class FaceArray(List[Face]):
1✔
13
    """The FaceArray is a sequence of Face objects. If the part is modified, then FaceArray must be updated for
14
    that part.
15

16
    .. note::
17
        This object can be accessed by::
18

19
            import part
20
            mdb.models[name].parts[name].allInternalSets[name].faces
21
            mdb.models[name].parts[name].allInternalSurfaces[name].faces
22
            mdb.models[name].parts[name].allSets[name].faces
23
            mdb.models[name].parts[name].allSurfaces[name].faces
24
            mdb.models[name].parts[name].faces
25
            mdb.models[name].parts[name].sets[name].faces
26
            mdb.models[name].parts[name].surfaces[name].faces
27
            import assembly
28
            mdb.models[name].rootAssembly.allInstances[name].faces
29
            mdb.models[name].rootAssembly.allInstances[name].sets[name].faces
30
            mdb.models[name].rootAssembly.allInstances[name].surfaces[name].faces
31
            mdb.models[name].rootAssembly.allInternalSets[name].faces
32
            mdb.models[name].rootAssembly.allInternalSurfaces[name].faces
33
            mdb.models[name].rootAssembly.allSets[name].faces
34
            mdb.models[name].rootAssembly.allSurfaces[name].faces
35
            mdb.models[name].rootAssembly.instances[name].faces
36
            mdb.models[name].rootAssembly.instances[name].sets[name].faces
37
            mdb.models[name].rootAssembly.instances[name].surfaces[name].faces
38
            mdb.models[name].rootAssembly.modelInstances[i].sets[name].faces
39
            mdb.models[name].rootAssembly.modelInstances[i].surfaces[name].faces
40
            mdb.models[name].rootAssembly.sets[name].faces
41
            mdb.models[name].rootAssembly.surfaces[name].faces
42
    """
43

44
    @abaqus_method_doc
1✔
45
    def __init__(self, faces: list[Face]) -> None:
1✔
46
        """This method creates a FaceArray object.
47

48
        .. note::
49
            This function can be accessed by::
50

51
                part.FaceArray
52

53
        Parameters
54
        ----------
55
        faces
56
            A list of Face objects.
57

58
        Returns
59
        -------
60
        FaceArray
61
            A FaceArray object.
62
        """
63
        ...
1✔
64

65
    @overload
1✔
66
    @abaqus_method_doc
1✔
67
    def findAt(
1✔
68
        self,
69
        coordinates: tuple[float, float, float],
70
        printWarning: Boolean = True,
71
    ) -> Face:
72
        ...
×
73

74
    @overload
1✔
75
    @abaqus_method_doc
1✔
76
    def findAt(
1✔
77
        self,
78
        coordinates: tuple[tuple[float, float, float],],
79
        printWarning: Boolean = True,
80
    ) -> list[Face]:
81
        ...
×
82

83
    @overload
1✔
84
    @abaqus_method_doc
1✔
85
    def findAt(
1✔
86
        self,
87
        *coordinates: tuple[tuple[float, float, float],],
88
        printWarning: Boolean = True,
89
    ) -> list[Face]:
90
        ...
×
91

92
    @abaqus_method_doc
1✔
93
    def findAt(self, *args, **kwargs) -> Union[Face, list[Face]]:
1✔
94
        """This method returns the object or objects in the FaceArray located at the given coordinates. findAt
95
        initially uses the ACIS tolerance of 1E-6. As a result, findAt returns any face that is at the arbitrary
96
        point specified or at a distance of less than 1E-6 from the arbitrary point. If nothing is found, findAt
97
        uses the tolerance for imprecise geometry (applicable only for imprecise geometric entities). The
98
        arbitrary point must not be shared by a second face. If two faces intersect or coincide at the arbitrary
99
        point, findAt chooses the first face that it encounters, and you should not rely on the return value
100
        being consistent. findAt will always try to find objects among all the faces in the part or assembly
101
        instance and will not restrict itself to a subset even if the FaceArray represents such subset.
102

103
        Parameters
104
        ----------
105
        coordinates
106
            A sequence of Floats specifying the **X**, **Y**, and **Z** coordinates of the object to
107
            find. ``findAt`` returns either a Face object or a sequence of Face objects based on the type
108
            of input.
109

110
            * If **coordinates** is a sequence of Floats, findAt returns the Face object at that point.
111

112
            * If you omit the **coordinates** keyword argument, findAt accepts as arguments a
113
              sequence of pairs of sequences describing each face's coordinate and normal, and findAt
114
              returns a sequence of Face objects at the given locations. If you omit the **coordinates**
115
              keyword argument, you must also omit the **normal** argument::
116

117
                faces = f.findAt(((-16.438578, -41.835673, -24.19804), ),
118
                                 ((25.210364, -35.689868, 1.860314), ),
119
                                 ((26.727683, -38.207055, 4.164759), ))
120
        normal
121
            A sequence of Floats specifying the **X**, **Y**, and **Z** components of a vector
122
            indicating the face normal.
123
        printWarning
124
            A Boolean specifying whether a message is to be printed to the CLI if no entity is found
125
            at the specified location. The default value is True.
126

127
        Returns
128
        -------
129
        Face
130
            A Face object.
131
        """
132
        first_arg = kwargs.get("coordinates", args[0] if args else ((),))
1✔
133
        return Face() if isinstance(first_arg[0], float) else [Face()]
1✔
134

135
    @abaqus_method_doc
1✔
136
    def getSequenceFromMask(self, mask: str):
1✔
137
        """This method returns the object or objects in the FaceArray identified using the specified **mask**.
138
        This command is generated when the JournalOptions are set to COMPRESSEDINDEX. When a large number of
139
        objects are involved, this method is highly efficient.
140

141
        Parameters
142
        ----------
143
        mask
144
            A String specifying the object or objects.
145

146
        Returns
147
        -------
148
        Face
149
            A Face object or a sequence of Face objects.
150
        """
151
        return Face() if isinstance(mask, str) else [Face()]
×
152

153
    @abaqus_method_doc
1✔
154
    def getMask(self) -> str:
1✔
155
        """This method returns a string specifying the object or objects.
156

157
        Returns
158
        -------
159
        str
160
            A String specifying the object or objects.
161
        """
162
        return ""
×
163

164
    @abaqus_method_doc
1✔
165
    def getByBoundingBox(
1✔
166
        self,
167
        xMin: float = 0,
168
        yMin: float = 0,
169
        zMin: float = 0,
170
        xMax: float = 0,
171
        yMax: float = 0,
172
        zMax: float = 0,
173
    ) -> FaceArray:
174
        """This method returns an array of face objects that lie within the specified bounding box.
175

176
        Parameters
177
        ----------
178
        xMin
179
            A float specifying the minimum **X** boundary of the bounding box.
180
        yMin
181
            A float specifying the minimum **Y** boundary of the bounding box.
182
        zMin
183
            A float specifying the minimum **Z** boundary of the bounding box.
184
        xMax
185
            A float specifying the maximum **X** boundary of the bounding box.
186
        yMax
187
            A float specifying the maximum **Y** boundary of the bounding box.
188
        zMax
189
            A float specifying the maximum **Z** boundary of the bounding box.
190

191
        Returns
192
        -------
193
        FaceArray
194
            A FaceArray object, which is a sequence of Face objects.
195
        """
196
        return FaceArray([Face()])
×
197

198
    @abaqus_method_doc
1✔
199
    def getByBoundingCylinder(self, center1: tuple, center2: tuple, radius: str) -> FaceArray:
1✔
200
        """This method returns an array of face objects that lie within the specified bounding cylinder.
201

202
        Parameters
203
        ----------
204
        center1
205
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the first end of the
206
            cylinder.
207
        center2
208
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the second end of the
209
            cylinder.
210
        radius
211
            A float specifying the radius of the cylinder.
212

213
        Returns
214
        -------
215
        FaceArray
216
            A FaceArray object, which is a sequence of Face objects.
217
        """
218
        return FaceArray([Face()])
×
219

220
    @abaqus_method_doc
1✔
221
    def getByBoundingSphere(self, center: tuple, radius: str) -> FaceArray:
1✔
222
        """This method returns an array of face objects that lie within the specified bounding sphere.
223

224
        Parameters
225
        ----------
226
        center
227
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the sphere.
228
        radius
229
            A float specifying the radius of the sphere.
230

231
        Returns
232
        -------
233
        FaceArray
234
            A FaceArray object, which is a sequence of Face objects.
235
        """
236
        return FaceArray([Face()])
×
237

238
    @abaqus_method_doc
1✔
239
    def getBoundingBox(self) -> dict[str, Sequence[float]]:
1✔
240
        """This method returns a dictionary of two tuples representing minimum and maximum boundary values of
241
        the bounding box of the minimum size containing the face sequence.
242

243
        Returns
244
        -------
245
        dict[str, Sequence[float]]
246
            A Dictionary object with the following items:
247

248
            - **low**: a tuple of three floats representing the minimum **X** -, **Y** -, and **Z**  -boundary
249
              values of the bounding box.
250
            - **high**: a tuple of three floats representing the maximum **X** -, **Y** -, and **Z**  -boundary
251
              values of the bounding box.
252
        """
253
        return {"low": (0.0, 0.0, 0.0), "high": (0.0, 0.0, 0.0)}
×
254

255
    @abaqus_method_doc
1✔
256
    def getClosest(
1✔
257
        self, coordinates: tuple, searchTolerance: str = ""
258
    ) -> dict[int, tuple[Face, tuple[float, float, float]]]:
259
        """This method returns an object or objects in the FaceArray closest to the given set of points, where
260
        the given points need not lie on the faces in the FaceArray.
261

262
        Parameters
263
        ----------
264
        coordinates
265
            A sequence of a sequence of floats, where each sequence of floats describes the **X**,
266
            **Y**, and **Z** coordinates of a point::
267

268
                >>> r=f.getClosest(coordinates=((20.0, 20.0, 10.0), (-1.0, -15.0, 15), ))
269
                >>> r.keys()
270
                [0, 1]
271
                >>> r[0]
272
                (mdb.models['Model-1'].parts['Part-1'].faces[0], (15.7090625762939, 20.0, 10.0))
273
        searchTolerance
274
            A double specifying the distance within which the closest object must lie. The default
275
            value is half of the parent part/instance size.
276

277
        Returns
278
        -------
279
        dict
280
            This method returns a dictionary object. The key to the dictionary object is the
281
            position of the input point in the tuple specified in the **coordinates** starting at
282
            index 0. If a closest face could be found then the value is a sequence consisting of two
283
            objects. The first object in the sequence is a Face that is close to the input point
284
            referred to by the key. The second object in the sequence is a sequence of floats that
285
            specifies the **X**, **Y**, and **Z**  location of the closest point on the Face to the given
286
            point. See program listing above.
287

288
        Raises
289
        ------
290
        Error
291
            The mask results in an empty sequence, An exception occurs if the resulting sequence is empty.
292
        """
293
        return {0: (Face(), (0.0, 0.0, 0.0))}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc