[bindings] ComplexGeoData

This commit is contained in:
Frank Martinez
2025-09-24 12:12:32 -05:00
parent 2fb6f7e15a
commit 3c782de402

View File

@@ -1,13 +1,16 @@
# SPDX-License: 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 as BoundBoxPy
from Base.BoundBox import BoundBox
from Base.Vector import Vector
from Base.Placement import Placement as PlacementPy
from Base.Placement import Placement
from Base.Rotation import Rotation
from Base.Matrix import Matrix
from StringHasher import StringHasher
from typing import Any, Final, List, Dict
from typing import Any, Final
@export(
Namespace="Data",
@@ -15,57 +18,57 @@ from typing import Any, Final, List, Dict
)
class ComplexGeoData(Persistence):
"""
Data.ComplexGeoData class.
Author: Juergen Riegel (Juergen.Riegel@web.de)
Licence: LGPL
UserDocu: Father of all complex geometric data types
Father of all complex geometric data types.
"""
@constmethod
def getElementTypes(self) -> List[str]:
def getElementTypes(self) -> list[str]:
"""
Return a list of element types present in the complex geometric data
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
Return the number of elements of a type.
"""
...
@constmethod
def getFacesFromSubElement(self) -> Any:
def getFacesFromSubElement(
self,
) -> tuple[list[Vector], list[tuple[int, int, int]]]:
"""
Return vertexes and faces from a sub-element
Return vertexes and faces from a sub-element.
"""
...
@constmethod
def getLinesFromSubElement(self) -> Any:
def getLinesFromSubElement(
self,
) -> tuple[list[Vector], list[tuple[int, int]]]:
"""
Return vertexes and lines from a sub-element
Return vertexes and lines from a sub-element.
"""
...
@constmethod
def getPoints(self) -> Any:
def getPoints(self) -> tuple[list[Vector], list[Vector]]:
"""
Return a tuple of points and normals with a given accuracy
"""
...
@constmethod
def getLines(self) -> Any:
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) -> Any:
def getFaces(self) -> tuple[list[Vector], list[tuple[int, int, int]]]:
"""
Return a tuple of points and triangles with a given accuracy
"""
@@ -89,15 +92,24 @@ class ComplexGeoData(Persistence):
"""
...
def setElementName(self, *, element: str, name: str = None, postfix: str = None, overwrite: bool = False, sid: Any = None) -> None:
def setElementName(
self,
*,
element: str,
name: str = None,
postfix: str = None,
overwrite: bool = False,
sid: Any = None,
) -> None:
"""
setElementName(element,name=None,postfix=None,overwrite=False,sid=None), Set an element name
Set an element name.
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
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
@@ -105,33 +117,33 @@ class ComplexGeoData(Persistence):
...
@constmethod
def getElementName(self, name: str, direction: int = 0) -> Any:
def getElementName(self, name: str, direction: int = 0) -> str:
"""
getElementName(name,direction=0) - Return a mapped element name or reverse
Return a mapped element name or reverse.
"""
...
@constmethod
def getElementIndexedName(self, name: str) -> Any:
def getElementIndexedName(self, name: str) -> str | tuple[str, list[int]]:
"""
getElementIndexedName(name) - Return the indexed element name
Return the indexed element name.
"""
...
@constmethod
def getElementMappedName(self, name: str) -> Any:
def getElementMappedName(self, name: str) -> str | tuple[str, list[int]]:
"""
getElementMappedName(name) - Return the mapped element name
Return the mapped element name
"""
...
BoundBox: Final[BoundBoxPy] = ...
BoundBox: Final[BoundBox] = ...
"""Get the bounding box (BoundBox) of the complex geometric data."""
CenterOfGravity: Final[Vector] = ...
"""Get the center of gravity"""
Placement: PlacementPy = ...
Placement: Placement = ...
"""Get the current transformation of the object as placement"""
Tag: int = 0
@@ -143,10 +155,10 @@ class ComplexGeoData(Persistence):
ElementMapSize: Final[int] = 0
"""Get the current element map size"""
ElementMap: Dict[Any, Any] = {}
ElementMap: dict[str, str] = {}
"""Get/Set a dict of element mapping"""
ElementReverseMap: Final[Dict[Any, Any]] = {}
ElementReverseMap: Final[dict[str, str | list[str]]] = {}
"""Get a dict of element reverse mapping"""
ElementMapVersion: Final[str] = ""