File size: 4,367 Bytes
985c397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# SPDX-License-Identifier: LGPL-2.1-or-later

from __future__ import annotations

from Base.Metadata import export, constmethod
from Base.Persistence import Persistence
from Base.BoundBox import BoundBox
from Base.Vector import Vector
from Base.Placement import Placement
from Base.Rotation import Rotation
from Base.Matrix import Matrix
from StringHasher import StringHasher
from typing import Any, Final


@export(
    Namespace="Data",
    Reference=True,
)
class ComplexGeoData(Persistence):
    """
    Father of all complex geometric data types.
    """

    @constmethod
    def getElementTypes(self) -> list[str]:
        """
        Return a list of element types present in the complex geometric data.
        """
        ...

    @constmethod
    def countSubElements(self) -> int:
        """
        Return the number of elements of a type.
        """
        ...

    @constmethod
    def getFacesFromSubElement(self, ) -> tuple[list[Vector], list[tuple[int, int, int]]]:
        """
        Return vertexes and faces from a sub-element.
        """
        ...

    @constmethod
    def getLinesFromSubElement(self, ) -> tuple[list[Vector], list[tuple[int, int]]]:
        """
        Return vertexes and lines from a sub-element.
        """
        ...

    @constmethod
    def getPoints(self) -> tuple[list[Vector], list[Vector]]:
        """
        Return a tuple of points and normals with a given accuracy
        """
        ...

    @constmethod
    def getLines(self) -> tuple[list[Vector], list[tuple[int, int]]]:
        """
        Return a tuple of points and lines with a given accuracy
        """
        ...

    @constmethod
    def getFaces(self) -> tuple[list[Vector], list[tuple[int, int, int]]]:
        """
        Return a tuple of points and triangles with a given accuracy
        """
        ...

    def applyTranslation(self, translation: Vector, /) -> None:
        """
        Apply an additional translation to the placement
        """
        ...

    def applyRotation(self, rotation: Rotation, /) -> None:
        """
        Apply an additional rotation to the placement
        """
        ...

    def transformGeometry(self, transformation: Matrix, /) -> None:
        """
        Apply a transformation to the underlying geometry
        """
        ...

    def setElementName(
        self,
        *,
        element: str,
        name: str = None,
        postfix: str = None,
        overwrite: bool = False,
        sid: Any = None,
    ) -> None:
        """
        Set an element name.

        Args:
            element  : the original element name, e.g. Edge1, Vertex2
            name     : the new name for the element, None to remove the mapping
            postfix  : postfix of the name that will not be hashed
            overwrite: if true, it will overwrite exiting name
            sid      : to hash the name any way you want, provide your own string id(s) in this parameter

        An element can have multiple mapped names. However, a name can only be mapped
        to one element
        """
        ...

    @constmethod
    def getElementName(self, name: str, direction: int = 0, /) -> str:
        """
        Return a mapped element name or reverse.
        """
        ...

    @constmethod
    def getElementIndexedName(self, name: str, /) -> str | tuple[str, list[int]]:
        """
        Return the indexed element name.
        """
        ...

    @constmethod
    def getElementMappedName(self, name: str, /) -> str | tuple[str, list[int]]:
        """
        Return the mapped element name
        """
        ...

    BoundBox: Final[BoundBox] = ...
    """Get the bounding box (BoundBox) of the complex geometric data."""

    CenterOfGravity: Final[Vector] = ...
    """Get the center of gravity"""

    Placement: Placement = ...
    """Get the current transformation of the object as placement"""

    Tag: int = 0
    """Geometry Tag"""

    Hasher: StringHasher = ...
    """Get/Set the string hasher of this object"""

    ElementMapSize: Final[int] = 0
    """Get the current element map size"""

    ElementMap: dict[str, str] = {}
    """Get/Set a dict of element mapping"""

    ElementReverseMap: Final[dict[str, str | list[str]]] = {}
    """Get a dict of element reverse mapping"""

    ElementMapVersion: Final[str] = ""
    """Element map version"""