• 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

75.0
/src/abaqus/BasicGeometry/VertexArray.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 ..Sketcher.ConstrainedSketchVertex.ConstrainedSketchVertex import (
1✔
8
    ConstrainedSketchVertex,
9
)
10
from ..UtilityAndView.abaqusConstants import Boolean
1✔
11
from .Vertex import Vertex
1✔
12

13

14
@abaqus_class_doc
1✔
15
class VertexArray(List[Vertex]):
1✔
16
    """The VertexArray is a sequence of ConstrainedSketchVertex objects. If the part is modified, then
17
    VertexArray must be updated for that part.
18

19
    .. note::
20
        This object can be accessed by::
21

22
            import part
23
            mdb.models[name].parts[name].allInternalSets[name].vertices
24
            mdb.models[name].parts[name].allSets[name].vertices
25
            mdb.models[name].parts[name].sets[name].vertices
26
            mdb.models[name].parts[name].vertices
27
            import assembly
28
            mdb.models[name].rootAssembly.allInstances[name].sets[name].vertices
29
            mdb.models[name].rootAssembly.allInstances[name].vertices
30
            mdb.models[name].rootAssembly.allInternalSets[name].vertices
31
            mdb.models[name].rootAssembly.allSets[name].vertices
32
            mdb.models[name].rootAssembly.instances[name].sets[name].vertices
33
            mdb.models[name].rootAssembly.instances[name].vertices
34
            mdb.models[name].rootAssembly.modelInstances[i].sets[name].vertices
35
            mdb.models[name].rootAssembly.modelInstances[i].vertices
36
            mdb.models[name].rootAssembly.sets[name].vertices
37
            mdb.models[name].rootAssembly.vertices
38
    """
39

40
    @abaqus_method_doc
1✔
41
    def __init__(self, vertices: list[Vertex]):
1✔
42
        """This method creates a VertexArray object.
43

44
        .. note::
45
            This function can be accessed by::
46

47
                part.VertexArray
48

49
        Parameters
50
        ----------
51
        vertices
52
            A list of ConstrainedSketchVertex objects.
53

54
        Returns
55
        -------
56
        VertexArray
57
            A VertexArray object.
58
        """
59
        ...
1✔
60

61
    @overload
1✔
62
    @abaqus_method_doc
1✔
63
    def findAt(
1✔
64
        self,
65
        coordinates: tuple[float, float, float],
66
        printWarning: Boolean = True,
67
    ) -> ConstrainedSketchVertex:
68
        ...
×
69

70
    @overload
1✔
71
    @abaqus_method_doc
1✔
72
    def findAt(
1✔
73
        self,
74
        coordinates: tuple[tuple[float, float, float],],
75
        printWarning: Boolean = True,
76
    ) -> list[ConstrainedSketchVertex]:
77
        ...
×
78

79
    @overload
1✔
80
    @abaqus_method_doc
1✔
81
    def findAt(
1✔
82
        self,
83
        *coordinates: tuple[tuple[float, float, float],],
84
        printWarning: Boolean = True,
85
    ) -> list[ConstrainedSketchVertex]:
86
        ...
×
87

88
    @abaqus_method_doc
1✔
89
    def findAt(self, *args, **kwargs) -> Union[ConstrainedSketchVertex, list[ConstrainedSketchVertex]]:
1✔
90
        """This method returns the object or objects in the VertexArray located at the given coordinates. findAt
91
        initially uses the ACIS tolerance of 1E-6. As a result, findAt returns any ConstrainedSketchVertex
92
        object that is at the arbitrary point specified or at a distance of less than 1E-6 from the arbitrary
93
        point. If nothing is found, findAt uses the tolerance for imprecise geometry (applicable only for
94
        imprecise geometric entities). findAt will always try to find objects among all the vertices in the part
95
        or assembly instance and will not restrict itself to a subset even if the VertexArray represents such
96
        subset.
97

98
        Parameters
99
        ----------
100
        coordinates
101
            A sequence of Floats specifying the **X**, **Y**, and **Z** coordinates of the object to
102
            find.findAt returns either a ConstrainedSketchVertex object or a sequence of ConstrainedSketchVertex objects based on the
103
            type of input.
104

105
            * If **coordinates** is a sequence of Floats, findAt returns the ConstrainedSketchVertex object at that point.
106

107
            * If you omit the **coordinates** keyword argument, findAt accepts as arguments a sequence of sequence
108
              of floats in the following format::
109

110
                verts = v.findAt(((20.19686, -169.513997, 27.798593), ),
111
                                ((19.657627, -167.295749, 27.056402), ),
112
                                ((18.274129, -157.144741, 25.15218), ))
113
        printWarning
114
            A Boolean specifying whether a message is to be printed to the CLI if no entity is found
115
            at the specified location. The default value is True.
116

117
        Returns
118
        -------
119
        ConstrainedSketchVertex
120
            A ConstrainedSketchVertex object or a sequence of ConstrainedSketchVertex objects..
121
        """
122
        first_arg = kwargs.get("coordinates", args[0] if args else ((),))
×
123
        return ConstrainedSketchVertex() if isinstance(first_arg[0], float) else [ConstrainedSketchVertex()]
×
124

125
    @overload
1✔
126
    @abaqus_method_doc
1✔
127
    def getSequenceFromMask(self, mask: str) -> ConstrainedSketchVertex:  # type: ignore
1✔
128
        ...
×
129

130
    @overload
1✔
131
    @abaqus_method_doc
1✔
132
    def getSequenceFromMask(self, mask: Sequence[str]) -> list[ConstrainedSketchVertex]:  # type: ignore
1✔
133
        ...
×
134

135
    @abaqus_method_doc
1✔
136
    def getSequenceFromMask(
1✔
137
        self, mask: Union[str, Sequence[str]]
138
    ) -> Union[ConstrainedSketchVertex, list[ConstrainedSketchVertex]]:  # type: ignore
139
        """This method returns the object or objects in the VertexArray identified using the specified **mask**.
140
        This command is generated when the JournalOptions are set to COMPRESSEDINDEX. When a large number of
141
        objects are involved, this method is highly efficient.
142

143
        Parameters
144
        ----------
145
        mask
146
            A String specifying the object or objects.
147

148
        Returns
149
        -------
150
        ConstrainedSketchVertex | list[ConstrainedSketchVertex]
151
            A ConstrainedSketchVertex object or a sequence of ConstrainedSketchVertex objects..
152
        """
153
        return ConstrainedSketchVertex() if isinstance(mask, str) else [ConstrainedSketchVertex()]
×
154

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

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

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

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

193
        Returns
194
        -------
195
        VertexArray
196
            A VertexArray object, which is a sequence of ConstrainedSketchVertex objects..
197
        """
198
        return VertexArray([Vertex()])
×
199

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

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

215
        Returns
216
        -------
217
        VertexArray
218
            A VertexArray object, which is a sequence of ConstrainedSketchVertex objects..
219
        """
220
        return VertexArray([Vertex()])
×
221

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

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

233
        Returns
234
        -------
235
        VertexArray
236
            A VertexArray object, which is a sequence of ConstrainedSketchVertex objects..
237
        """
238
        return VertexArray([Vertex()])
×
239

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

245
        Returns
246
        -------
247
        dict[str, tuple[float, float, float]]
248
            A Dictionary object with the following items:
249

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

257
    @abaqus_method_doc
1✔
258
    def getClosest(self, coordinates: tuple, searchTolerance: str = "") -> dict[int, tuple[Vertex, tuple]]:
1✔
259
        """This method returns a object or objects in the VertexArray closest to the given set of points, where
260
        the given points need not lie on ConstrainedSketchVertex objects in the VertexArray.
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=v.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'].vertices[0], (15.7090625762939, 29.1666641235352, 20.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 vertex could be found then the value is a sequence consisting of
283
            two objects. The first object in the sequence is a ConstrainedSketchVertex that is close to the input
284
            point referred to by the key. The second object in the sequence is a sequence of floats
285
            that specifies the **X**, **Y**, and **Z**  location of the ConstrainedSketchVertex. See program listing
286
            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: (Vertex(), (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