| 1 |
from Base.Metadata import export, constmethod |
| 2 |
from Base.Persistence import Persistence |
| 3 |
from Base.BoundBox import BoundBox as BoundBoxPy |
| 4 |
from Base.Vector import Vector |
| 5 |
from Base.Placement import Placement as PlacementPy |
| 6 |
from Base.Rotation import Rotation |
| 7 |
from Base.Matrix import Matrix |
| 8 |
from StringHasher import StringHasher |
| 9 |
from typing import Any, Final, List, Dict |
| 10 |
|
| 11 |
|
| 12 |
@export( |
| 13 |
Namespace="Data", |
| 14 |
Reference=True, |
| 15 |
) |
| 16 |
class ComplexGeoData(Persistence): |
| 17 |
""" |
| 18 |
Data.ComplexGeoData class. |
| 19 |
|
| 20 |
Author: Juergen Riegel ([email protected]) |
| 21 |
Licence: LGPL |
| 22 |
UserDocu: Father of all complex geometric data types |
| 23 |
""" |
| 24 |
|
| 25 |
@constmethod |
| 26 |
def getElementTypes(self) -> List[str]: |
| 27 |
""" |
| 28 |
Return a list of element types present in the complex geometric data |
| 29 |
""" |
| 30 |
... |
| 31 |
|
| 32 |
@constmethod |
| 33 |
def countSubElements(self) -> int: |
| 34 |
""" |
| 35 |
Return the number of elements of a type |
| 36 |
""" |
| 37 |
... |
| 38 |
|
| 39 |
@constmethod |
| 40 |
def getFacesFromSubElement(self) -> Any: |
| 41 |
""" |
| 42 |
Return vertexes and faces from a sub-element |
| 43 |
""" |
| 44 |
... |
| 45 |
|
| 46 |
@constmethod |
| 47 |
def getLinesFromSubElement(self) -> Any: |
| 48 |
""" |
| 49 |
Return vertexes and lines from a sub-element |
| 50 |
""" |
| 51 |
... |
| 52 |
|
| 53 |
@constmethod |
| 54 |
def getPoints(self) -> Any: |
| 55 |
""" |
| 56 |
Return a tuple of points and normals with a given accuracy |
| 57 |
""" |
| 58 |
... |
| 59 |
|
| 60 |
@constmethod |
| 61 |
def getLines(self) -> Any: |
| 62 |
""" |
| 63 |
Return a tuple of points and lines with a given accuracy |
| 64 |
""" |
| 65 |
... |
| 66 |
|
| 67 |
@constmethod |
| 68 |
def getFaces(self) -> Any: |
| 69 |
""" |
| 70 |
Return a tuple of points and triangles with a given accuracy |
| 71 |
""" |
| 72 |
... |
| 73 |
|
| 74 |
def applyTranslation(self, translation: Vector) -> None: |
| 75 |
""" |
| 76 |
Apply an additional translation to the placement |
| 77 |
""" |
| 78 |
... |
| 79 |
|
| 80 |
def applyRotation(self, rotation: Rotation) -> None: |
| 81 |
""" |
| 82 |
Apply an additional rotation to the placement |
| 83 |
""" |
| 84 |
... |
| 85 |
|
| 86 |
def transformGeometry(self, transformation: Matrix) -> None: |
| 87 |
""" |
| 88 |
Apply a transformation to the underlying geometry |
| 89 |
""" |
| 90 |
... |
| 91 |
|
| 92 |
def setElementName(self, *, element: str, name: str = None, postfix: str = None, overwrite: bool = False, sid: Any = None) -> None: |
| 93 |
""" |
| 94 |
setElementName(element,name=None,postfix=None,overwrite=False,sid=None), Set an element name |
| 95 |
|
| 96 |
element : the original element name, e.g. Edge1, Vertex2 |
| 97 |
name : the new name for the element, None to remove the mapping |
| 98 |
postfix : postfix of the name that will not be hashed |
| 99 |
overwrite: if true, it will overwrite exiting name |
| 100 |
sid : to hash the name any way you want, provide your own string id(s) in this parameter |
| 101 |
|
| 102 |
An element can have multiple mapped names. However, a name can only be mapped |
| 103 |
to one element |
| 104 |
""" |
| 105 |
... |
| 106 |
|
| 107 |
@constmethod |
| 108 |
def getElementName(self, name: str, direction: int = 0) -> Any: |
| 109 |
""" |
| 110 |
getElementName(name,direction=0) - Return a mapped element name or reverse |
| 111 |
""" |
| 112 |
... |
| 113 |
|
| 114 |
@constmethod |
| 115 |
def getElementIndexedName(self, name: str) -> Any: |
| 116 |
""" |
| 117 |
getElementIndexedName(name) - Return the indexed element name |
| 118 |
""" |
| 119 |
... |
| 120 |
|
| 121 |
@constmethod |
| 122 |
def getElementMappedName(self, name: str) -> Any: |
| 123 |
""" |
| 124 |
getElementMappedName(name) - Return the mapped element name |
| 125 |
""" |
| 126 |
... |
| 127 |
|
| 128 |
BoundBox: Final[BoundBoxPy] = ... |
| 129 |
"""Get the bounding box (BoundBox) of the complex geometric data.""" |
| 130 |
|
| 131 |
CenterOfGravity: Final[Vector] = ... |
| 132 |
"""Get the center of gravity""" |
| 133 |
|
| 134 |
Placement: PlacementPy = ... |
| 135 |
"""Get the current transformation of the object as placement""" |
| 136 |
|
| 137 |
Tag: int = 0 |
| 138 |
"""Geometry Tag""" |
| 139 |
|
| 140 |
Hasher: StringHasher = ... |
| 141 |
"""Get/Set the string hasher of this object""" |
| 142 |
|
| 143 |
ElementMapSize: Final[int] = 0 |
| 144 |
"""Get the current element map size""" |
| 145 |
|
| 146 |
ElementMap: Dict[Any, Any] = {} |
| 147 |
"""Get/Set a dict of element mapping""" |
| 148 |
|
| 149 |
ElementReverseMap: Final[Dict[Any, Any]] = {} |
| 150 |
"""Get a dict of element reverse mapping""" |
| 151 |
|
| 152 |
ElementMapVersion: Final[str] = "" |
| 153 |
"""Element map version""" |