diff --git a/src/Mod/Fem/App/FemMesh.pyi b/src/Mod/Fem/App/FemMesh.pyi index 14e5c0c6a4..d43b06bdab 100644 --- a/src/Mod/Fem/App/FemMesh.pyi +++ b/src/Mod/Fem/App/FemMesh.pyi @@ -2,12 +2,17 @@ from __future__ import annotations -from typing import Any, Final +from typing import Any, Final, overload from Base.Metadata import constmethod, export - +from Base.Vector import Vector +from Base.Placement import Placement from App.ComplexGeoData import ComplexGeoData - +from Part.App.TopoShape import TopoShape +from Part.App.TopoShapeFace import TopoShapeFace +from Part.App.TopoShapeEdge import TopoShapeEdge +from Part.App.TopoShapeSolid import TopoShapeSolid +from Part.App.TopoShapeVertex import TopoShapeVertex @export( Include="Mod/Fem/App/FemMesh.h", @@ -24,219 +29,248 @@ class FemMesh(ComplexGeoData): License: LGPL-2.1-or-later """ - def setShape(self) -> Any: + def setShape(self, shape: TopoShape, /) -> None: """Set the Part shape to mesh""" ... - def compute(self) -> Any: + def compute(self) -> None: """Update the internal mesh structure""" ... - def addHypothesis(self) -> Any: + def addHypothesis(self, hypothesis: object, shape: TopoShape, /) -> None: """Add hypothesis""" ... - def setStandardHypotheses(self) -> Any: + def setStandardHypotheses(self) -> None: """Set some standard hypotheses for the whole shape""" ... - def addNode(self) -> Any: + def addNode(self, x: float, y: float, z: float, elem_id: int | None = None, /) -> int: """Add a node by setting (x,y,z).""" ... - def addEdge(self) -> Any: + @overload + def addEdge(self, n1: int, n2: int, /) -> int: ... + + @overload + def addEdge(self, nodes: list[int], elem_id: int | None = None, /) -> int: ... + + def addEdge(self, *args) -> int: """Add an edge by setting two node indices.""" ... - def addEdgeList(self) -> Any: + def addEdgeList(self, nodes: list[int], np: list[int], /) -> list[int]: """Add list of edges by list of node indices and list of nodes per edge.""" ... + @overload + def addFace(self, n1: int, n2: int, n3: int, /) -> int: ... + + @overload + def addFace(self, nodes: list[int], elem_id: int | None = None, /) -> int: ... + def addFace(self) -> Any: """Add a face by setting three node indices.""" ... - def addFaceList(self) -> Any: + def addFaceList(self, nodes: list[int], np: list[int], /) -> list[int]: """Add list of faces by list of node indices and list of nodes per face.""" ... - def addQuad(self) -> Any: + def addQuad(self, n1: int, n2: int, n3: int, n4: int, /) -> int: """Add a quad by setting four node indices.""" ... - def addVolume(self) -> Any: + @overload + def addVolume(self, n1: int, n2: int, n3: int, n4: int, /) -> int: ... + + @overload + def addVolume(self, nodes: list[int], elem_id: int | None = None, /) -> int: ... + + def addVolume(self, *args) -> int: """Add a volume by setting an arbitrary number of node indices.""" ... - def addVolumeList(self) -> Any: + def addVolumeList(self, nodes: list[int], np: list[int], /) -> list[int]: """Add list of volumes by list of node indices and list of nodes per volume.""" ... - def read(self) -> Any: + def read(self, file_name: str, /) -> None: """ Read in a various FEM mesh file formats. - read(file.endingToExportTo) - supported formats: DAT, INP, MED, STL, UNV, VTK, Z88""" + + + Supported formats: DAT, INP, MED, STL, UNV, VTK, Z88 + """ ... @constmethod - def write(self) -> Any: + def write(self, file_name: str, /) -> None: """ Write out various FEM mesh file formats. - write(file.endingToExportTo) - supported formats: BDF, DAT, INP, MED, STL, UNV, VTK, Z88""" + + Supported formats: BDF, DAT, INP, MED, STL, UNV, VTK, Z88 + """ ... @constmethod - def writeABAQUS(self, **kwargs) -> Any: + def writeABAQUS( + self, + fileName: str, + elemParam: int, + groupParam: bool, + volVariant: str = "standard", + faceVariant: str = "shell", + edgeVariant: str = "beam") -> None: """ - Write out as ABAQUS inp - writeABAQUS(file, int elemParam, bool groupParam, str volVariant, str faceVariant, str edgeVariant) + Write out as ABAQUS inp. - elemParam: - 0: All elements - 1: Highest elements only - 2: FEM elements only (only edges not belonging to faces and faces not belonging to volumes) + elemParam: + 0: All elements + 1: Highest elements only + 2: FEM elements only (only edges not belonging to faces and faces not belonging to volumes) - groupParam: - True: Write group data - False: Do not write group data + groupParam: + True: Write group data + False: Do not write group data - volVariant: Volume elements - "standard": Tetra4 -> C3D4, Penta6 -> C3D6, Hexa8 -> C3D8, Tetra10 -> C3D10, Penta15 -> C3D15, Hexa20 -> C3D20 - "reduced": Hexa8 -> C3D8R, Hexa20 -> C3D20R - "incompatible": Hexa8 -> C3D8I - "modified": Tetra10 -> C3D10T - "fluid": Tetra4 -> F3D4, Penta6 -> F3D6, Hexa8 -> F3D8 + volVariant: Volume elements + "standard": Tetra4 -> C3D4, Penta6 -> C3D6, Hexa8 -> C3D8, Tetra10 -> C3D10, Penta15 -> C3D15, Hexa20 -> C3D20 + "reduced": Hexa8 -> C3D8R, Hexa20 -> C3D20R + "incompatible": Hexa8 -> C3D8I + "modified": Tetra10 -> C3D10T + "fluid": Tetra4 -> F3D4, Penta6 -> F3D6, Hexa8 -> F3D8 - faceVariant: Face elements - "shell": Tria3 -> S3, Quad4 -> S4, Tria6 -> S6, Quad8 -> S8 - "shell reduced": Tria3 -> S3, Quad4 -> S4R, Tria6 -> S6, Quad8 -> S8R - "membrane": Tria3 -> M3D3, Quad4 -> M3D4, Tria6 -> M3D6, Quad8 -> M3D8 - "membrane reduced": Tria3 -> M3D3, Quad4 -> M3D4R, Tria6 -> M3D6, Quad8 -> M3D8R - "stress": Tria3 -> CPS3, Quad4 -> CPS4, Tria6 -> CPS6, Quad8 -> CPS8 - "stress reduced": Tria3 -> CPS3, Quad4 -> CPS4R, Tria6 -> CPS6, Quad8 -> CPS8R - "strain": Tria3 -> CPE3, Quad4 -> CPE4, Tria6 -> CPE6, Quad8 -> CPE8 - "strain reduced": Tria3 -> CPE3, Quad4 -> CPE4R, Tria6 -> CPE6, Quad8 -> CPE8R - "axisymmetric": Tria3 -> CAX3, Quad4 -> CAX4, Tria6 -> CAX6, Quad8 -> CAX8 - "axisymmetric reduced": Tria3 -> CAX3, Quad4 -> CAX4R, Tria6 -> CAX6, Quad8 -> CAX8R + faceVariant: Face elements + "shell": Tria3 -> S3, Quad4 -> S4, Tria6 -> S6, Quad8 -> S8 + "shell reduced": Tria3 -> S3, Quad4 -> S4R, Tria6 -> S6, Quad8 -> S8R + "membrane": Tria3 -> M3D3, Quad4 -> M3D4, Tria6 -> M3D6, Quad8 -> M3D8 + "membrane reduced": Tria3 -> M3D3, Quad4 -> M3D4R, Tria6 -> M3D6, Quad8 -> M3D8R + "stress": Tria3 -> CPS3, Quad4 -> CPS4, Tria6 -> CPS6, Quad8 -> CPS8 + "stress reduced": Tria3 -> CPS3, Quad4 -> CPS4R, Tria6 -> CPS6, Quad8 -> CPS8R + "strain": Tria3 -> CPE3, Quad4 -> CPE4, Tria6 -> CPE6, Quad8 -> CPE8 + "strain reduced": Tria3 -> CPE3, Quad4 -> CPE4R, Tria6 -> CPE6, Quad8 -> CPE8R + "axisymmetric": Tria3 -> CAX3, Quad4 -> CAX4, Tria6 -> CAX6, Quad8 -> CAX8 + "axisymmetric reduced": Tria3 -> CAX3, Quad4 -> CAX4R, Tria6 -> CAX6, Quad8 -> CAX8R - edgeVariant: Edge elements - "beam": Seg2 -> B31, Seg3 -> B32 - "beam reduced": Seg2 -> B31R, Seg3 -> B32R - "truss": Seg2 -> T3D2, eg3 -> T3D3 - "network": Seg3 -> D + edgeVariant: Edge elements + "beam": Seg2 -> B31, Seg3 -> B32 + "beam reduced": Seg2 -> B31R, Seg3 -> B32R + "truss": Seg2 -> T3D2, eg3 -> T3D3 + "network": Seg3 -> D - Elements are selected according to CalculiX availability. - For example if volume variant "modified" is selected, Tetra10 mesh - elements are assigned to C3D10T and remain elements uses "standard". - Axisymmetric, plane strain and plane stress elements expect nodes in the plane z=0. + Elements are selected according to CalculiX availability. + For example if volume variant "modified" is selected, Tetra10 mesh + elements are assigned to C3D10T and remain elements uses "standard". + Axisymmetric, plane strain and plane stress elements expect nodes in the plane z=0. """ ... - def setTransform(self) -> Any: + def setTransform(self, placement: Placement, /) -> None: """Use a Placement object to perform a translation or rotation""" ... @constmethod - def copy(self) -> Any: + def copy(self) -> FemMesh: """Make a copy of this FEM mesh.""" ... @constmethod - def getFacesByFace(self) -> Any: + def getFacesByFace(self, face: TopoShapeFace, /) -> list[int]: """Return a list of face IDs which belong to a TopoFace""" ... @constmethod - def getEdgesByEdge(self) -> Any: + def getEdgesByEdge(self, edge: TopoShapeEdge, /) -> list[int]: """Return a list of edge IDs which belong to a TopoEdge""" ... @constmethod - def getVolumesByFace(self) -> Any: - """Return a dict of volume IDs and face IDs which belong to a TopoFace""" + def getVolumesByFace(self, face: TopoShapeFace, /) -> list[tuple[int, int]]: + """Return a list of tuples of volume IDs and face IDs which belong to a TopoFace""" ... @constmethod - def getccxVolumesByFace(self) -> Any: - """Return a dict of volume IDs and ccx face numbers which belong to a TopoFace""" + def getccxVolumesByFace(self, face: TopoShapeFace, /) -> list[tuple[int, int]]: + """Return a list of tuples of volume IDs and ccx face numbers which belong to a TopoFace""" ... @constmethod - def getNodeById(self) -> Any: + def getNodeById(self, node_id: int, /) -> Vector: """Get the node position vector by a Node-ID""" ... @constmethod - def getNodesBySolid(self) -> Any: + def getNodesBySolid(self, shape: TopoShapeSolid, /) -> list[int]: """Return a list of node IDs which belong to a TopoSolid""" ... @constmethod - def getNodesByFace(self) -> Any: + def getNodesByFace(self, face: TopoShapeFace, /) -> list[int]: """Return a list of node IDs which belong to a TopoFace""" ... @constmethod - def getNodesByEdge(self) -> Any: + def getNodesByEdge(self, edge: TopoShapeEdge, /) -> list[int]: """Return a list of node IDs which belong to a TopoEdge""" ... @constmethod - def getNodesByVertex(self) -> Any: + def getNodesByVertex(self, vertex: TopoShapeVertex, /) -> list[int]: """Return a list of node IDs which belong to a TopoVertex""" ... @constmethod - def getElementNodes(self) -> Any: + def getElementNodes(self, elem_id: int, /) -> tuple[int, ...]: """Return a tuple of node IDs to a given element ID""" ... @constmethod - def getNodeElements(self) -> Any: + def getNodeElements(self, elem_id: int, elem_type: str = "All", /) -> tuple[int, ...]: """Return a tuple of specific element IDs associated to a given node ID""" ... @constmethod - def getGroupName(self) -> Any: + def getGroupName(self, elem_id: int, /) -> str: """Return a string of group name to a given group ID""" ... @constmethod - def getGroupElementType(self) -> Any: + def getGroupElementType(self, elem_id: int, /) -> str: """Return a string of group element type to a given group ID""" ... @constmethod - def getGroupElements(self) -> Any: + def getGroupElements(self, elem_id: int, /) -> tuple[int, ...]: """Return a tuple of ElementIDs to a given group ID""" ... @constmethod - def addGroup(self) -> Any: + def addGroup(self, name: str, group_type: str, group_id: int = -1, /) -> None: """ Add a group to mesh with specific name and type - addGroup(name, typestring, [id]) - name: string - typestring: "All", "Node", "Edge", "Face", "Volume", "0DElement", "Ball" - id: int - Optional id is used to force specific id for group, but does - not work, yet.""" + + name: string + group_type: "All", "Node", "Edge", "Face", "Volume", "0DElement", "Ball" + group_id: int + Optional group_id is used to force specific id for group, but does + not work, yet. + """ ... @constmethod - def addGroupElements(self) -> Any: + def addGroupElements(self, group_id: int, elements: list[int], /) -> None: """ Add a tuple of ElementIDs to a given group ID - addGroupElements(groupid, list_of_elements) - groupid: int - list_of_elements: list of int - Notice that the elements have to be in the mesh.""" + + group_id: int + elements: list of int + Notice that the elements have to be in the mesh. + """ ... @constmethod - def removeGroup(self) -> Any: + def removeGroup(self, group_id: int, /) -> bool: """ Remove a group with a given group ID removeGroup(groupid) @@ -253,12 +287,12 @@ class FemMesh(ComplexGeoData): ... @constmethod - def getElementType(self) -> Any: + def getElementType(self, elem_id: int, /) -> str: """Return the element type of a given ID""" ... @constmethod - def getIdByElementType(self) -> Any: + def getIdByElementType(self, elem_type: str, /) -> tuple[int, ...]: """Return a tuple of IDs to a given element type""" ... diff --git a/src/Mod/Fem/App/FemPostFilter.pyi b/src/Mod/Fem/App/FemPostFilter.pyi index bc756ce819..e4e606d9d5 100644 --- a/src/Mod/Fem/App/FemPostFilter.pyi +++ b/src/Mod/Fem/App/FemPostFilter.pyi @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Any +from typing import Any, TypeAlias from Base.Metadata import export - from Fem.FemPostObject import FemPostObject +vtkAlgorithm: TypeAlias = object @export( Include="Mod/Fem/App/FemPostFilter.h", @@ -23,36 +23,39 @@ class FemPostFilter(FemPostObject): License: LGPL-2.1-or-later """ - def addFilterPipeline(self) -> Any: + def addFilterPipeline(self, name: str, source: vtkAlgorithm, target: vtkAlgorithm, /) -> None: """Registers a new vtk filter pipeline for data processing. Arguments are (name, source algorithm, target algorithm).""" ... - def setActiveFilterPipeline(self) -> Any: + def setActiveFilterPipeline(self, name: str, /) -> None: """Sets the filter pipeline that shall be used for data processing. Argument is the name of the filter pipeline to activate.""" ... - def getParentPostGroup(self) -> Any: + def getParentPostGroup(self) -> object: """Returns the postprocessing group the filter is in (e.g. a pipeline or branch object). None is returned if not in any.""" ... - def getInputData(self) -> Any: - """Returns the dataset available at the filter's input. + def getInputData(self) -> object: + """ + Returns the dataset available at the filter's input. Note: Can lead to a full recompute of the whole pipeline, hence best to call this only in "execute", where the user expects long calculation cycles. """ ... - def getInputVectorFields(self) -> Any: - """Returns the names of all vector fields available on this filter's input. + def getInputVectorFields(self) -> list[str]: + """ + Returns the names of all vector fields available on this filter's input. Note: Can lead to a full recompute of the whole pipeline, hence best to call this only in "execute", where the user expects long calculation cycles. """ ... - def getInputScalarFields(self) -> Any: - """Returns the names of all scalar fields available on this filter's input. + def getInputScalarFields(self) -> list[str]: + """ + Returns the names of all scalar fields available on this filter's input. Note: Can lead to a full recompute of the whole pipeline, hence best to call this only in "execute", where the user expects long calculation cycles. """ ... - def getOutputAlgorithm(self) -> Any: + def getOutputAlgorithm(self) -> vtkAlgorithm: """Returns the filters vtk algorithm currently used as output (the one generating the Data field). Note that the output algorithm may change depending on filter settings.""" ... diff --git a/src/Mod/Fem/App/FemPostObject.pyi b/src/Mod/Fem/App/FemPostObject.pyi index e3c0e95ff6..22eb53f624 100644 --- a/src/Mod/Fem/App/FemPostObject.pyi +++ b/src/Mod/Fem/App/FemPostObject.pyi @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Any +from typing import TypeAlias from Base.Metadata import export - from App.GeoFeature import GeoFeature +vtkDataSet: TypeAlias = object @export( Include="Mod/Fem/App/FemPostObject.h", @@ -23,18 +23,25 @@ class FemPostObject(GeoFeature): License: LGPL-2.1-or-later """ - def writeVTK(self) -> Any: - """writeVTK(filename) -> None - + def writeVTK(self, file_name: str, /) -> None: + """ Write data object to VTK file. filename: str - File extension is automatically detected from data type.""" - ... - - def getDataSet(self) -> Any: - """getDataset() -> vtkDataSet - - Returns the current output dataset. For normal filters this is equal to the objects Data property output. However, a pipelines Data property could store multiple frames, and hence Data can be of type vtkCompositeData, which is not a vtkDataset. To simplify implementations this function always returns a vtkDataSet, and for a pipeline it will be the dataset of the currently selected frame. Note that the returned value could be None, if no data is set at all. + File extension is automatically detected from data type. + """ + ... + + def getDataSet(self) -> vtkDataSet: + """ + Returns the current output dataset. + For normal filters this is equal to the objects Data property output. + However, a pipelines Data property could store multiple frames, and hence + Data can be of type vtkCompositeData, which is not a vtkDataset. + + To simplify implementations this function always returns a vtkDataSet, + and for a pipeline it will be the dataset of the currently selected frame. + + Note that the returned value could be None, if no data is set at all. """ ... diff --git a/src/Mod/Fem/App/FemPostPipeline.pyi b/src/Mod/Fem/App/FemPostPipeline.pyi index aba0bf7a97..073d50a2a2 100644 --- a/src/Mod/Fem/App/FemPostPipeline.pyi +++ b/src/Mod/Fem/App/FemPostPipeline.pyi @@ -2,12 +2,14 @@ from __future__ import annotations -from typing import Any +from typing import Any, overload, TypeAlias from Base.Metadata import export - +from Base.Unit import Unit from Fem.FemPostObject import FemPostObject +from App.DocumentObject import DocumentObject +vtkAlgorithm: TypeAlias = object @export( Include="Mod/Fem/App/FemPostPipeline.h", @@ -23,52 +25,83 @@ class FemPostPipeline(FemPostObject): License: LGPL-2.1-or-later """ - def read(self) -> Any: - """read(filepath) - read([filepaths], [values], unit, frame_type) + @overload + def read(self, file_name: str, /) -> None: ... - Reads in a single vtk file or creates a multiframe result by reading in multiple result files. If multiframe is wanted, 4 argumenhts are needed: + @overload + def read( + self, + files: list[str] | tuple[str], + values: list[int] | tuple[int], + unit: Unit, + frame_type: str, + /, + ) -> None: ... + + def read(self, *args) -> None: + """ + Reads in a single vtk file or creates a multiframe result by reading in multiple result files. + + If multiframe is wanted, 4 argumenhts are needed: 1. List of result files each being one frame, 2. List of values valid for each frame (e.g. [s] if time data), 3. the unit of the value as FreeCAD.Units.Unit, - 4. the Description of the frame type""" + 4. the Description of the frame type + """ ... - def scale(self) -> Any: + def scale(self, scale: float, /) -> None: """scale the points of a loaded vtk file""" ... - def load(self) -> Any: - """load(result_object) - load([result_objects], [values], unit, frame_type) + @overload + def load(self, obj: DocumentObject, /) -> None: ... - Load a single result object or create a multiframe result by loading multiple result frames. If multiframe is wanted, 4 argumenhts are needed: - 1. List of result files each being one frame, + @overload + def load( + self, + result: list[DocumentObject] | tuple[DocumentObject], + values: list[float] | tuple[float], + unit: Unit, + frame_type: str, + /, + ) -> None: ... + + def load(self, *args) -> Any: + """ + Load a single result object or create a multiframe result by loading multiple result frames. + + If multiframe is wanted, 4 argumenhts are needed: + 1. List of result objects each being one frame, 2. List of values valid for each frame (e.g. [s] if time data), 3. the unit of the value as FreeCAD.Units.Unit, - 4. the Description of the frame type""" + 4. the Description of the frame type + """ ... - def getFilter(self) -> Any: + def getFilter(self) -> list[object]: """Returns all filters, that this pipeline uses (non recursive, result does not contain branch child filters)""" ... - def recomputeChildren(self) -> Any: + def recomputeChildren(self) -> None: """Recomputes all children of the pipeline""" ... - def getLastPostObject(self) -> Any: + def getLastPostObject(self) -> DocumentObject | None: """Get the last post-processing object""" ... - def holdsPostObject(self) -> Any: + def holdsPostObject(self, obj: DocumentObject, /) -> bool: """Check if this pipeline holds a given post-processing object""" ... - def renameArrays(self) -> Any: + def renameArrays(self, names: dict[str, str], /) -> None: """Change name of data arrays""" ... - def getOutputAlgorithm(self) -> Any: - """Returns the pipeline vtk algorithm, which generates the data passed to the pipelines filters. Note that the output algorithm may change depending on pipeline settings.""" + def getOutputAlgorithm(self) -> vtkAlgorithm: + """Returns the pipeline vtk algorithm, which generates the data passed to the pipelines filters. + + Note that the output algorithm may change depending on pipeline settings. + """ ... diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraint.pyi b/src/Mod/Fem/Gui/ViewProviderFemConstraint.pyi index f4fc527a68..013a272619 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraint.pyi +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraint.pyi @@ -21,17 +21,17 @@ class ViewProviderFemConstraint(ViewProviderGeometryObject): License: LGPL-2.1-or-later """ - def loadSymbol(self) -> Any: - """loadSymbol(filename) -> None - + def loadSymbol(self, file_name: str, /) -> Any: + """ Load constraint symbol from Open Inventor file. The file structure should be as follows: A separator containing a separator with the symbol used in multiple copies at points on the surface and an optional separator with a symbol excluded from multiple copies. - filename : str - Open Inventor file.""" + file_name : str + Open Inventor file. + """ ... SymbolNode: Final[Any]