From ca435629b887e09f7d52db905e227aa399ea5799 Mon Sep 17 00:00:00 2001 From: Ian 'z0r0' Abreu Date: Sun, 31 Aug 2025 15:34:03 -0400 Subject: [PATCH] Finalizing Python interface bindings for Import, Measure, Mesh, Points. --- src/Mod/Import/App/CMakeLists.txt | 5 +- .../App/{StepShapePy.pyi => StepShape.pyi} | 8 +- src/Mod/Import/App/StepShapePy.xml | 30 - src/Mod/Measure/App/CMakeLists.txt | 11 +- .../{MeasureBasePy.pyi => MeasureBase.pyi} | 8 +- src/Mod/Measure/App/MeasureBasePy.xml | 20 - .../{MeasurementPy.pyi => Measurement.pyi} | 8 +- src/Mod/Measure/App/MeasurementPy.xml | 79 --- src/Mod/Measure/Gui/CMakeLists.txt | 5 +- .../{QuickMeasurePy.pyi => QuickMeasure.pyi} | 8 +- src/Mod/Measure/Gui/QuickMeasurePy.xml | 19 - src/Mod/Mesh/App/CMakeLists.txt | 26 +- src/Mod/Mesh/App/{EdgePy.pyi => Edge.pyi} | 8 +- src/Mod/Mesh/App/EdgePy.xml | 90 --- src/Mod/Mesh/App/{FacetPy.pyi => Facet.pyi} | 8 +- src/Mod/Mesh/App/FacetPy.xml | 139 ---- src/Mod/Mesh/App/{MeshPy.pyi => Mesh.pyi} | 4 +- .../{MeshFeaturePy.pyi => MeshFeature.pyi} | 5 +- src/Mod/Mesh/App/MeshFeaturePy.xml | 104 --- .../App/{MeshPointPy.pyi => MeshPoint.pyi} | 8 +- src/Mod/Mesh/App/MeshPointPy.xml | 78 --- src/Mod/Mesh/App/MeshPy.xml | 621 ------------------ src/Mod/Mesh/Gui/CMakeLists.txt | 5 +- ...roviderMeshPy.pyi => ViewProviderMesh.pyi} | 8 +- src/Mod/Mesh/Gui/ViewProviderMeshPy.xml | 49 -- src/Mod/Points/App/CMakeLists.txt | 5 +- .../Points/App/{PointsPy.pyi => Points.pyi} | 3 +- src/Mod/Points/App/PointsPy.xml | 75 --- .../templates/templateClassPyExport.py | 4 + 29 files changed, 37 insertions(+), 1404 deletions(-) rename src/Mod/Import/App/{StepShapePy.pyi => StepShape.pyi} (70%) delete mode 100644 src/Mod/Import/App/StepShapePy.xml rename src/Mod/Measure/App/{MeasureBasePy.pyi => MeasureBase.pyi} (50%) delete mode 100644 src/Mod/Measure/App/MeasureBasePy.xml rename src/Mod/Measure/App/{MeasurementPy.pyi => Measurement.pyi} (88%) delete mode 100644 src/Mod/Measure/App/MeasurementPy.xml rename src/Mod/Measure/Gui/{QuickMeasurePy.pyi => QuickMeasure.pyi} (55%) delete mode 100644 src/Mod/Measure/Gui/QuickMeasurePy.xml rename src/Mod/Mesh/App/{EdgePy.pyi => Edge.pyi} (89%) delete mode 100644 src/Mod/Mesh/App/EdgePy.xml rename src/Mod/Mesh/App/{FacetPy.pyi => Facet.pyi} (93%) delete mode 100644 src/Mod/Mesh/App/FacetPy.xml rename src/Mod/Mesh/App/{MeshPy.pyi => Mesh.pyi} (99%) rename src/Mod/Mesh/App/{MeshFeaturePy.pyi => MeshFeature.pyi} (95%) delete mode 100644 src/Mod/Mesh/App/MeshFeaturePy.xml rename src/Mod/Mesh/App/{MeshPointPy.pyi => MeshPoint.pyi} (86%) delete mode 100644 src/Mod/Mesh/App/MeshPointPy.xml delete mode 100644 src/Mod/Mesh/App/MeshPy.xml rename src/Mod/Mesh/Gui/{ViewProviderMeshPy.pyi => ViewProviderMesh.pyi} (77%) delete mode 100644 src/Mod/Mesh/Gui/ViewProviderMeshPy.xml rename src/Mod/Points/App/{PointsPy.pyi => Points.pyi} (97%) delete mode 100644 src/Mod/Points/App/PointsPy.xml diff --git a/src/Mod/Import/App/CMakeLists.txt b/src/Mod/Import/App/CMakeLists.txt index 823aae31da..10baab56f6 100644 --- a/src/Mod/Import/App/CMakeLists.txt +++ b/src/Mod/Import/App/CMakeLists.txt @@ -29,7 +29,7 @@ SET(Import_SRCS ReaderIges.h ReaderStep.cpp ReaderStep.h - StepShapePy.xml + StepShape.pyi StepShape.h StepShape.cpp StepShapePyImp.cpp @@ -76,8 +76,7 @@ SET(SCL_Resources ) SOURCE_GROUP("SCL" FILES ${SCL_Resources}) -generate_from_xml(StepShapePy) -generate_from_py_(StepShapePy) +generate_from_py(StepShape) add_library(Import SHARED ${Import_SRCS}) target_link_libraries(Import ${Import_LIBS}) diff --git a/src/Mod/Import/App/StepShapePy.pyi b/src/Mod/Import/App/StepShape.pyi similarity index 70% rename from src/Mod/Import/App/StepShapePy.pyi rename to src/Mod/Import/App/StepShape.pyi index 5a0b319c94..924e514c49 100644 --- a/src/Mod/Import/App/StepShapePy.pyi +++ b/src/Mod/Import/App/StepShape.pyi @@ -4,18 +4,12 @@ from Base.Metadata import export from Base.PyObjectBase import PyObjectBase @export( - Father="PyObjectBase", - Name="StepShapePy", - Twin="StepShape", - TwinPointer="StepShape", Include="Mod/Import/App/StepShape.h", Namespace="Import", - FatherInclude="Base/PyObjectBase.h", - FatherNamespace="Base", Constructor=True, Delete=True, ) -class StepShapePy(PyObjectBase): +class StepShape(PyObjectBase): """ StepShape in Import This class gives a interface to retrieve TopoShapes out of an loaded STEP file of any kind. diff --git a/src/Mod/Import/App/StepShapePy.xml b/src/Mod/Import/App/StepShapePy.xml deleted file mode 100644 index 9605bc1e52..0000000000 --- a/src/Mod/Import/App/StepShapePy.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - StepShape in a Import - StepShape in Import -This class gives a interface to retrieve TopoShapes out of an loaded STEP file of any kind. - - - - - method read() -Read a STEP file into memory and make it accessible - - - - - - diff --git a/src/Mod/Measure/App/CMakeLists.txt b/src/Mod/Measure/App/CMakeLists.txt index c10dfd202a..75f30bbe6c 100644 --- a/src/Mod/Measure/App/CMakeLists.txt +++ b/src/Mod/Measure/App/CMakeLists.txt @@ -10,16 +10,13 @@ set(Measure_LIBS FreeCADApp ) -generate_from_xml(MeasurementPy) -generate_from_xml(MeasureBasePy) - -generate_from_py_(MeasurementPy) -generate_from_py_(MeasureBasePy) +generate_from_py(Measurement) +generate_from_py(MeasureBase) SET(Python_SRCS - MeasurementPy.xml + Measurement.pyi MeasurementPyImp.cpp - MeasureBasePy.xml + MeasureBase.pyi MeasureBasePyImp.cpp ) SOURCE_GROUP("Python" FILES ${Python_SRCS}) diff --git a/src/Mod/Measure/App/MeasureBasePy.pyi b/src/Mod/Measure/App/MeasureBase.pyi similarity index 50% rename from src/Mod/Measure/App/MeasureBasePy.pyi rename to src/Mod/Measure/App/MeasureBase.pyi index 6337c2b977..8a54897167 100644 --- a/src/Mod/Measure/App/MeasureBasePy.pyi +++ b/src/Mod/Measure/App/MeasureBase.pyi @@ -3,17 +3,11 @@ from Base.Metadata import export from App.DocumentObject import DocumentObject @export( - Father="DocumentObjectPy", - Name="MeasureBasePy", - Twin="MeasureBase", - TwinPointer="MeasureBase", Include="Mod/Measure/App/MeasureBase.h", Namespace="Measure", - FatherInclude="App/DocumentObjectPy.h", - FatherNamespace="App", Constructor=True, ) -class MeasureBasePy(DocumentObject): +class MeasureBase(DocumentObject): """ User documentation here """ diff --git a/src/Mod/Measure/App/MeasureBasePy.xml b/src/Mod/Measure/App/MeasureBasePy.xml deleted file mode 100644 index c56bf805d1..0000000000 --- a/src/Mod/Measure/App/MeasureBasePy.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - User documentation here - - Developer documentation here - - - diff --git a/src/Mod/Measure/App/MeasurementPy.pyi b/src/Mod/Measure/App/Measurement.pyi similarity index 88% rename from src/Mod/Measure/App/MeasurementPy.pyi rename to src/Mod/Measure/App/Measurement.pyi index 5aee411fff..33d6843c2c 100644 --- a/src/Mod/Measure/App/MeasurementPy.pyi +++ b/src/Mod/Measure/App/Measurement.pyi @@ -4,17 +4,11 @@ from Base.BaseClass import BaseClass from Base.Metadata import export @export( - Father="BaseClassPy", - Name="MeasurementPy", - Twin="Measurement", - TwinPointer="Measurement", Include="Mod/Measure/App/Measurement.h", Namespace="Measure", - FatherInclude="Base/BaseClassPy.h", - FatherNamespace="Base", Constructor=True, ) -class MeasurementPy(BaseClass): +class Measurement(BaseClass): """ Make a measurement """ diff --git a/src/Mod/Measure/App/MeasurementPy.xml b/src/Mod/Measure/App/MeasurementPy.xml deleted file mode 100644 index d6a994409d..0000000000 --- a/src/Mod/Measure/App/MeasurementPy.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - Make a measurement - - - - add a geometric reference - - - - - does Measurement have links to 3D geometry - - - - - measure the difference between references to obtain resultant vector - - - - - measure the difference between references to obtain resultant vector - - - - - measure the length of the references - - - - - measure the volume of the references - - - - - measure the area of the references - - - - - measure the line-Line Distance of the references. Returns 0 if references are not 2 lines. - - - - - measure the plane-plane distance of the references. Returns 0 if references are not 2 planes. - - - - - measure the angle between two edges - - - - - measure the radius of an arc or circle edge - - - - - measure the center of mass for selected volumes - - - - diff --git a/src/Mod/Measure/Gui/CMakeLists.txt b/src/Mod/Measure/Gui/CMakeLists.txt index 3650f0cb7b..594a2a1c73 100644 --- a/src/Mod/Measure/Gui/CMakeLists.txt +++ b/src/Mod/Measure/Gui/CMakeLists.txt @@ -28,8 +28,7 @@ SET(MeasureGui_UIC_SRCS DlgPrefsMeasureAppearanceImp.ui ) -generate_from_xml(QuickMeasurePy) -generate_from_py_(QuickMeasurePy) +generate_from_py(QuickMeasure) SET(MeasureGui_SRCS ${CMAKE_SOURCE_DIR}/src/Mod/Measure/InitGui.py @@ -39,7 +38,7 @@ SET(MeasureGui_SRCS Resources/Measure.qrc PreCompiled.cpp PreCompiled.h - QuickMeasurePy.xml + QuickMeasure.pyi QuickMeasurePyImp.cpp QuickMeasure.cpp QuickMeasure.h diff --git a/src/Mod/Measure/Gui/QuickMeasurePy.pyi b/src/Mod/Measure/Gui/QuickMeasure.pyi similarity index 55% rename from src/Mod/Measure/Gui/QuickMeasurePy.pyi rename to src/Mod/Measure/Gui/QuickMeasure.pyi index d87878eaf8..68dfbd0fe9 100644 --- a/src/Mod/Measure/Gui/QuickMeasurePy.pyi +++ b/src/Mod/Measure/Gui/QuickMeasure.pyi @@ -2,18 +2,12 @@ from Base.Metadata import export from Base.PyObjectBase import PyObjectBase @export( - Father="PyObjectBase", - Name="QuickMeasurePy", - Twin="QuickMeasure", - TwinPointer="QuickMeasure", Include="Mod/Measure/Gui/QuickMeasure.h", Namespace="MeasureGui", - FatherInclude="Base/PyObjectBase.h", - FatherNamespace="Base", Constructor=True, Delete=True, ) -class QuickMeasurePy(PyObjectBase): +class QuickMeasure(PyObjectBase): """ Selection Observer for the QuickMeasure label. """ diff --git a/src/Mod/Measure/Gui/QuickMeasurePy.xml b/src/Mod/Measure/Gui/QuickMeasurePy.xml deleted file mode 100644 index 24a1f70d15..0000000000 --- a/src/Mod/Measure/Gui/QuickMeasurePy.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Selection Observer for the QuickMeasure label. - - - diff --git a/src/Mod/Mesh/App/CMakeLists.txt b/src/Mod/Mesh/App/CMakeLists.txt index 96ece0f970..99b4479ff3 100644 --- a/src/Mod/Mesh/App/CMakeLists.txt +++ b/src/Mod/Mesh/App/CMakeLists.txt @@ -30,24 +30,18 @@ list(APPEND Mesh_LIBS ${QtConcurrent_LIBRARIES} ) -generate_from_xml(EdgePy) -generate_from_xml(FacetPy) -generate_from_xml(MeshFeaturePy) -generate_from_xml(MeshPointPy) -generate_from_xml(MeshPy) - -generate_from_py_(EdgePy) -generate_from_py_(FacetPy) -generate_from_py_(MeshFeaturePy) -generate_from_py_(MeshPointPy) -generate_from_py_(MeshPy) +generate_from_py(Edge) +generate_from_py(Facet) +generate_from_py(MeshFeature) +generate_from_py(MeshPoint) +generate_from_py(Mesh) SET(Mesh_XML_SRCS - EdgePy.xml - FacetPy.xml - MeshFeaturePy.xml - MeshPointPy.xml - MeshPy.xml + Edge.pyi + Facet.pyi + MeshFeature.pyi + MeshPoint.pyi + Mesh.pyi ) SOURCE_GROUP("XML" FILES ${Mesh_XML_SRCS}) diff --git a/src/Mod/Mesh/App/EdgePy.pyi b/src/Mod/Mesh/App/Edge.pyi similarity index 89% rename from src/Mod/Mesh/App/EdgePy.pyi rename to src/Mod/Mesh/App/Edge.pyi index f2dc9872de..45538102af 100644 --- a/src/Mod/Mesh/App/EdgePy.pyi +++ b/src/Mod/Mesh/App/Edge.pyi @@ -4,18 +4,12 @@ from Base.Metadata import export from Base.PyObjectBase import PyObjectBase @export( - Father="PyObjectBase", - Name="EdgePy", - Twin="Edge", - TwinPointer="Edge", Include="Mod/Mesh/App/Edge.h", Namespace="Mesh", - FatherInclude="Base/PyObjectBase.h", - FatherNamespace="Base", Constructor=True, Delete=True, ) -class EdgePy(PyObjectBase): +class Edge(PyObjectBase): """ Edge in mesh This is an edge of a facet in a MeshObject. You can get it by e.g. iterating over the facets of a diff --git a/src/Mod/Mesh/App/EdgePy.xml b/src/Mod/Mesh/App/EdgePy.xml deleted file mode 100644 index 4416925a1d..0000000000 --- a/src/Mod/Mesh/App/EdgePy.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - Edge in a Mesh - Edge in mesh -This is an edge of a facet in a MeshObject. You can get it by e.g. iterating over the facets of a -mesh and calling getEdge(index). - - - - - intersectWithEdge(Edge) -> list -Get a list of intersection points with another edge. - - - - - - isParallel(Edge) -> bool -Checks if the two edges are parallel. - - - - - - isCollinear(Edge) -> bool -Checks if the two edges are collinear. - - - - - - method unbound() -Cut the connection to a MeshObject. The edge becomes -free and is more or less a simple edge. -After calling unbound() no topological operation will -work! - - - - - - The index of this edge of the facet - - - - - - A list of points of the edge - - - - - - The index tuple of point vertices of the mesh this edge is built of - - - - - - The index tuple of neighbour facets of the mesh this edge is adjacent with - - - - - - The length of the edge - - - - - - Bound state of the edge - - - - - diff --git a/src/Mod/Mesh/App/FacetPy.pyi b/src/Mod/Mesh/App/Facet.pyi similarity index 93% rename from src/Mod/Mesh/App/FacetPy.pyi rename to src/Mod/Mesh/App/Facet.pyi index 3768508193..37fb5e8287 100644 --- a/src/Mod/Mesh/App/FacetPy.pyi +++ b/src/Mod/Mesh/App/Facet.pyi @@ -4,18 +4,12 @@ from Base.Metadata import export from Base.PyObjectBase import PyObjectBase @export( - Father="PyObjectBase", - Name="FacetPy", - Twin="Facet", - TwinPointer="Facet", Include="Mod/Mesh/App/Facet.h", Namespace="Mesh", - FatherInclude="Base/PyObjectBase.h", - FatherNamespace="Base", Constructor=True, Delete=True, ) -class FacetPy(PyObjectBase): +class Facet(PyObjectBase): """ Facet in mesh This is a facet in a MeshObject. You can get it by e.g. iterating a diff --git a/src/Mod/Mesh/App/FacetPy.xml b/src/Mod/Mesh/App/FacetPy.xml deleted file mode 100644 index dcf12f12bd..0000000000 --- a/src/Mod/Mesh/App/FacetPy.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - Facet in a Mesh - Facet in mesh -This is a facet in a MeshObject. You can get it by e.g. iterating a -mesh. The facet has a connection to its mesh and allows therefore -topological operations. It is also possible to create an unbounded facet e.g. to create -a mesh. In this case the topological operations will fail. The same is -when you cut the bound to the mesh by calling unbound(). - - - - - method unbound() -Cut the connection to a MeshObject. The facet becomes -free and is more or less a simple facet. -After calling unbound() no topological operation will -work! - - - - - - intersect(Facet) -> list -Get a list of intersection points with another triangle. - - - - - - isDegenerated([float]) -> boolean -Returns true if the facet is degenerated, otherwise false. - - - - - - isDegenerated(MinAngle, MaxAngle) -> boolean -Returns true if the facet is deformed, otherwise false. -A triangle is considered deformed if an angle is less than MinAngle -or higher than MaxAngle. -The two angles are given in radian. - - - - - - getEdge(int) -> Edge -Returns the edge of the facet. - - - - - - The index of this facet in the MeshObject - - - - - - Bound state of the facet - - - - - - Normal vector of the facet. - - - - - - A list of points of the facet - - - - - - The index tuple of point vertices of the mesh this facet is built of - - - - - - The index tuple of neighbour facets of the mesh this facet is adjacent with - - - - - - The area of the facet - - - - - - The aspect ratio of the facet computed by longest edge and its height - - - - - - The aspect ratio of the facet computed by radius of circum-circle and in-circle - - - - - - The roundness of the facet - - - - - - The center and radius of the circum-circle - - - - - - The center and radius of the in-circle - - - - - diff --git a/src/Mod/Mesh/App/MeshPy.pyi b/src/Mod/Mesh/App/Mesh.pyi similarity index 99% rename from src/Mod/Mesh/App/MeshPy.pyi rename to src/Mod/Mesh/App/Mesh.pyi index fe925667b6..c29b7e3d98 100644 --- a/src/Mod/Mesh/App/MeshPy.pyi +++ b/src/Mod/Mesh/App/Mesh.pyi @@ -5,8 +5,6 @@ from Base.Metadata import constmethod, export from App.ComplexGeoData import ComplexGeoData @export( - Father="ComplexGeoDataPy", - Name="MeshPy", Twin="MeshObject", TwinPointer="MeshObject", Include="Mod/Mesh/App/Mesh.h", @@ -21,7 +19,7 @@ from App.ComplexGeoData import ComplexGeoData friend class PropertyMeshKernel; class PropertyMeshKernel* parentProperty = nullptr;""" ) -class MeshPy(ComplexGeoData): +class Mesh(ComplexGeoData): """Mesh() -- Create an empty mesh object. This class allows one to manipulate the mesh object by adding new facets, deleting facets, importing from an STL file, diff --git a/src/Mod/Mesh/App/MeshFeaturePy.pyi b/src/Mod/Mesh/App/MeshFeature.pyi similarity index 95% rename from src/Mod/Mesh/App/MeshFeaturePy.pyi rename to src/Mod/Mesh/App/MeshFeature.pyi index 13237b3284..54ee0c810f 100644 --- a/src/Mod/Mesh/App/MeshFeaturePy.pyi +++ b/src/Mod/Mesh/App/MeshFeature.pyi @@ -5,16 +5,13 @@ from Base.Metadata import export from App.GeoFeature import GeoFeature @export( - Father="GeoFeaturePy", - Name="MeshFeaturePy", Twin="Feature", TwinPointer="Feature", Include="Mod/Mesh/App/MeshFeature.h", Namespace="Mesh", FatherInclude="App/GeoFeaturePy.h", - FatherNamespace="App", ) -class MeshFeaturePy(GeoFeature): +class MeshFeature(GeoFeature): """ The Mesh::Feature class handles meshes. The Mesh.MeshFeature() function is for internal use only and cannot be used to create instances of this class. diff --git a/src/Mod/Mesh/App/MeshFeaturePy.xml b/src/Mod/Mesh/App/MeshFeaturePy.xml deleted file mode 100644 index 3049d4296e..0000000000 --- a/src/Mod/Mesh/App/MeshFeaturePy.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - The Mesh::Feature class handles meshes. -The Mesh.MeshFeature() function is for internal use only and cannot be used to create instances of this class. -Therefore you must have a reference to a document, e.g. 'd' then you can create an instance with -d.addObject("Mesh::Feature"). - - - - - Return the number of vertices of the mesh object - - - - - Return the number of facets of the mesh object - - - - - Adjust wrong oriented facets - - - - - Smooth the mesh data - - - - - -Decimate the mesh -decimate(tolerance(Float), reduction(Float)) -tolerance: maximum error -reduction: reduction factor must be in the range [0.0,1.0] -Example: -mesh.decimate(0.5, 0.1) # reduction by up to 10 percent -mesh.decimate(0.5, 0.9) # reduction by up to 90 percent - -or - -decimate(targwt size(int)) -mesh.decimate(mesh.CountFacets/2) - - - - - - Remove non-manifolds - - - - - Remove non-manifold points - - - - - Repair any invalid indices - - - - - Remove degenerated facets - - - - - Remove duplicated facets - - - - - Remove duplicated points - - - - - Repair self-intersections - - - - - Remove folds on surfaces - - - - - Remove points with invalid coordinates (NaN) - - - - diff --git a/src/Mod/Mesh/App/MeshPointPy.pyi b/src/Mod/Mesh/App/MeshPoint.pyi similarity index 86% rename from src/Mod/Mesh/App/MeshPointPy.pyi rename to src/Mod/Mesh/App/MeshPoint.pyi index 90df79a66d..67d82b5ade 100644 --- a/src/Mod/Mesh/App/MeshPointPy.pyi +++ b/src/Mod/Mesh/App/MeshPoint.pyi @@ -4,18 +4,12 @@ from Base.Metadata import export from Base.PyObjectBase import PyObjectBase @export( - Father="PyObjectBase", - Name="MeshPointPy", - Twin="MeshPoint", - TwinPointer="MeshPoint", Include="Mod/Mesh/App/MeshPoint.h", Namespace="Mesh", - FatherInclude="Base/PyObjectBase.h", - FatherNamespace="Base", Constructor=True, Delete=True, ) -class MeshPointPy(PyObjectBase): +class MeshPoint(PyObjectBase): """ Point in mesh This is a point in a MeshObject. You can get it by e.g. iterating a diff --git a/src/Mod/Mesh/App/MeshPointPy.xml b/src/Mod/Mesh/App/MeshPointPy.xml deleted file mode 100644 index a701386272..0000000000 --- a/src/Mod/Mesh/App/MeshPointPy.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - Point in a Mesh - Point in mesh -This is a point in a MeshObject. You can get it by e.g. iterating a -mesh. The point has a connection to its mesh and allows therefore -topological operations. It is also possible to create an unbounded mesh point e.g. to create -a mesh. In this case the topological operations will fail. The same is -when you cut the bound to the mesh by calling unbound(). - - - - - method unbound() -Cut the connection to a MeshObject. The point becomes -free and is more or less a simple vector/point. -After calling unbound() no topological operation will -work! - - - - - - The index of this point in the MeshObject - - - - - - Bound state of the point - - - - - - Normal vector of the point computed by the surrounding mesh. - - - - - - Vector of the point. - - - - - - The X component of the point. - - - - - - The Y component of the point. - - - - - - The Z component of the point. - - - - - diff --git a/src/Mod/Mesh/App/MeshPy.xml b/src/Mod/Mesh/App/MeshPy.xml deleted file mode 100644 index d68f43574f..0000000000 --- a/src/Mod/Mesh/App/MeshPy.xml +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - Mesh() -- Create an empty mesh object. - -This class allows one to manipulate the mesh object by adding new facets, deleting facets, importing from an STL file, -transforming the mesh and much more. -For a complete overview of what can be done see also the documentation of mesh. -A mesh object cannot be added to an existing document directly. Therefore the document must create an object -with a property class that supports meshes. -Example: -m = Mesh.Mesh() -... # Manipulate the mesh -d = FreeCAD.activeDocument() # Get a reference to the actie document -f = d.addObject("Mesh::Feature", "Mesh") # Create a mesh feature -f.Mesh = m # Assign the mesh object to the internal property -d.recompute() - - - - Read in a mesh object from file. -mesh.read(Filename='mymesh.stl') -mesh.read(Stream=file,Format='STL') - - - - - Write the mesh object into file. -mesh.write(Filename='mymesh.stl',[Format='STL',Name='Object name',Material=colors]) -mesh.write(Stream=file,Format='STL',[Name='Object name',Material=colors]) - - - - - Write the mesh in OpenInventor format to a string. - - - - - Create a copy of this mesh - - - - - Move the point along their normals - - - - - Move the point along their normals - - - - - Get cross-sections of the mesh through several planes - - - - - Union of this and the given mesh object. - - - - - Intersection of this and the given mesh object. - - - - - Difference of this and the given mesh object. - - - - - Get the part inside of the intersection - - - - - Get the part outside the intersection - - - - - Get the section curves of this and the given mesh object. -lines = mesh.section(mesh2, [ConnectLines=True, MinDist=0.0001]) - - - - - - Apply a translation to the mesh - - - - - Apply a rotation to the mesh - - - - - Apply a transformation to the mesh - - - - - Transform the mesh to its eigenbase - - - - - Get Eigen base of the mesh - - - - - Add a facet to the mesh - - - - - Add a list of facets to the mesh - - - - - Remove a list of facet indices from the mesh - - - - - Remove all edges that are smaller than a given length - - - - - Remove facets whose all three points are on the boundary - - - - - Builds a list of facet indices with triangles that are inside a volume mesh - - - - - Repairs the neighbourhood which might be broken - - - - - Combine this mesh with another mesh. - - - - - -setPoint(int, Vector) -Sets the point at index. - - - - - - -movePoint(int, Vector) -This method moves the point in the mesh along the -given vector. This affects the geometry of the mesh. -Be aware that moving points may cause self-intersections. - - - - - - -getPointNormals() -Get the normals of the points. - - - - - - Add a list of facet indices that describes a segment to the mesh - - - - - Get the number of segments which may also be 0 - - - - - Get a list of facet indices that describes a segment - - - - - -Returns a list containing the different -components (separated areas) of the mesh as separate meshes - -import Mesh -for c in mesh.getSeparatecomponents(): -Mesh.show(c) - - - - - - - Get a list of the indices of selected facets - - - - - Get a list of the indices of selected points - - - - - Create a mesh from segment - - - - - Clear the mesh - - - - - Check if the mesh is a solid - - - - - Check if the mesh has non-manifolds - - - - - Remove non-manifolds - - - - - Remove non-manifold points - - - - - Check if the mesh intersects itself - - - - - Returns a tuple of indices of intersecting triangles - - - - - Repair self-intersections - - - - - Remove folds on surfaces - - - - - Check if the mesh has facets with inconsistent orientation - - - - - Get the number of wrong oriented facets - - - - - Get a tuple of wrong oriented facets - - - - - Check if the mesh has points with invalid coordinates (NaN) - - - - - Remove points with invalid coordinates (NaN) - - - - - Check if points lie on edges - - - - - removePointsOnEdge(FillBoundary=False) -Remove points that lie on edges. -If FillBoundary is True then the holes by removing the affected facets -will be re-filled. - - - - - Check if the mesh has invalid neighbourhood indices - - - - - Check if the mesh has point indices that are out of range - - - - - Check if the mesh has facet indices that are out of range - - - - - Check if the mesh has corrupted facets - - - - - Get the number of topologic independent areas - - - - - Remove components with less or equal to number of given facets - - - - - Repair any invalid indices - - - - - Repair caps by swapping the edge - - - - - Repair deformed facets - - - - - Remove degenerated facets - - - - - Remove duplicated points - - - - - Remove duplicated facets - - - - - Refine the mesh - - - - - Split all edges - - - - - Split edge - - - - - Split facet - - - - - Swap the common edge with the neighbour - - - - - Remove an edge and both facets that share this edge - - - - - Remove a facet - - - - - Remove a list of facets - - - - - Insert a vertex into a facet - - - - - Insert a new facet at the border - - - - - Get detailed information about the mesh - - - - - Get a list of facet indices and intersection points - - - - - Cuts the mesh with a given closed polygon -cut(list, int) -> None -The argument list is an array of points, a polygon -The argument int is the mode: 0=inner, 1=outer - - - - - - Trims the mesh with a given closed polygon -trim(list, int) -> None -The argument list is an array of points, a polygon -The argument int is the mode: 0=inner, 1=outer - - - - - - Trims the mesh with a given plane -trimByPlane(Vector, Vector) -> None -The plane is defined by a base and normal vector. Depending on the -direction of the normal the part above or below will be kept. - - - - - - - Adjust wrong oriented facets - - - - - Flip the mesh normals - - - - - Fillup holes - - - - - Smooth the mesh -smooth([iteration=1,maxError=FLT_MAX]) - - - - - -Decimate the mesh -decimate(tolerance(Float), reduction(Float)) -tolerance: maximum error -reduction: reduction factor must be in the range [0.0,1.0] -Example: -mesh.decimate(0.5, 0.1) # reduction by up to 10 percent -mesh.decimate(0.5, 0.9) # reduction by up to 90 percent - - - - - - Merge facets to optimize topology - - - - - Optimize the edges to get nicer facets - - - - - Optimize the edges to get nicer facets - - - - - - nearestFacetOnRay(tuple, tuple) -> dict -Get the index and intersection point of the nearest facet to a ray. -The first parameter is a tuple of three floats the base point of the ray, -the second parameter is ut uple of three floats for the direction. -The result is a dictionary with an index and the intersection point or -an empty dictionary if there is no intersection. - - - - - - getPlanarSegments(dev,[min faces=0]) -> list -Get all planes of the mesh as segment. -In the worst case each triangle can be regarded as single -plane if none of its neighbours is coplanar. - - - - - getSegmentsOfType(type, dev,[min faces=0]) -> list -Get all segments of type. -Type can be Plane, Cylinder or Sphere - - - - - getSegmentsByCurvature(list) -> list -The argument list gives a list if tuples where it defines the preferred maximum curvature, -the preferred minimum curvature, the tolerances and the number of minimum faces for the segment. -Example: -c=(1.0, 0.0, 0.1, 0.1, 500) # search for a cylinder with radius 1.0 -p=(0.0, 0.0, 0.1, 0.1, 500) # search for a plane -mesh.getSegmentsByCurvature([c,p]) - - - - - - -getCurvaturePerVertex() -> list -The items in the list contains minimum and maximum curvature with their directions - - - - - - A collection of the mesh points -With this attribute it is possible to get access to the points of the mesh -for p in mesh.Points: - print p.x, p.y, p.z - - - - - - Return the number of vertices of the mesh object. - - - - - - Return the number of edges of the mesh object. - - - - - - A collection of facets -With this attribute it is possible to get access to the facets of the mesh -for p in mesh.Facets: - print p - - - - - - Return the number of facets of the mesh object. - - - - - - Return the points and face indices as tuple. - - - - - - Return the area of the mesh object. - - - - - - Return the volume of the mesh object. - - - - - private: - friend class PropertyMeshKernel; - class PropertyMeshKernel* parentProperty = nullptr; - - diff --git a/src/Mod/Mesh/Gui/CMakeLists.txt b/src/Mod/Mesh/Gui/CMakeLists.txt index 4bda63c12a..2f6e3aab83 100644 --- a/src/Mod/Mesh/Gui/CMakeLists.txt +++ b/src/Mod/Mesh/Gui/CMakeLists.txt @@ -15,11 +15,10 @@ set(MeshGui_LIBS FreeCADGui ) -generate_from_xml(ViewProviderMeshPy) -generate_from_py_(ViewProviderMeshPy) +generate_from_py(ViewProviderMesh) SET(MeshGui_XML_SRCS - ViewProviderMeshPy.xml + ViewProviderMesh.pyi ) SOURCE_GROUP("XML" FILES ${MeshGui_XML_SRCS}) diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshPy.pyi b/src/Mod/Mesh/Gui/ViewProviderMesh.pyi similarity index 77% rename from src/Mod/Mesh/Gui/ViewProviderMeshPy.pyi rename to src/Mod/Mesh/Gui/ViewProviderMesh.pyi index f5fa59bc01..4747926c43 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshPy.pyi +++ b/src/Mod/Mesh/Gui/ViewProviderMesh.pyi @@ -3,16 +3,10 @@ from Gui.ViewProviderGeometryObject import ViewProviderGeometryObject from Base.Metadata import export @export( - Father="ViewProviderGeometryObjectPy", - Name="ViewProviderMeshPy", - Twin="ViewProviderMesh", - TwinPointer="ViewProviderMesh", Include="Mod/Mesh/Gui/ViewProvider.h", Namespace="MeshGui", - FatherInclude="Gui/ViewProviderGeometryObjectPy.h", - FatherNamespace="Gui", ) -class ViewProviderMeshPy(ViewProviderGeometryObject): +class ViewProviderMesh(ViewProviderGeometryObject): """ This is the ViewProvider base class """ diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshPy.xml b/src/Mod/Mesh/Gui/ViewProviderMeshPy.xml deleted file mode 100644 index aee4a45e9c..0000000000 --- a/src/Mod/Mesh/Gui/ViewProviderMeshPy.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - This is the ViewProvider base class - - - - Select list of facets - - - - - Add list of facets to selection - - - - - Remove list of facets from selection - - - - - Invert the selection - - - - - Clear the selection - - - - - Highlights the segments of a mesh with a given list of colors. -The number of elements of this list must be equal to the number of mesh segments. - - - - - diff --git a/src/Mod/Points/App/CMakeLists.txt b/src/Mod/Points/App/CMakeLists.txt index 8b9f59e2b8..2dccb8d184 100644 --- a/src/Mod/Points/App/CMakeLists.txt +++ b/src/Mod/Points/App/CMakeLists.txt @@ -38,15 +38,14 @@ list(APPEND Points_LIBS ${QtConcurrent_LIBRARIES} ) -generate_from_xml(PointsPy) -generate_from_py_(PointsPy) +generate_from_py(Points) SET(Points_SRCS AppPoints.cpp AppPointsPy.cpp Points.cpp Points.h - PointsPy.xml + Points.pyi PointsPyImp.cpp PointsAlgos.cpp PointsAlgos.h diff --git a/src/Mod/Points/App/PointsPy.pyi b/src/Mod/Points/App/Points.pyi similarity index 97% rename from src/Mod/Points/App/PointsPy.pyi rename to src/Mod/Points/App/Points.pyi index fa30353feb..860ec81bad 100644 --- a/src/Mod/Points/App/PointsPy.pyi +++ b/src/Mod/Points/App/Points.pyi @@ -5,7 +5,6 @@ from Data import object @export( Father="ComplexGeoDataPy", - Name="PointsPy", Twin="PointKernel", TwinPointer="PointKernel", Include="Mod/Points/App/Points.h", @@ -14,7 +13,7 @@ from Data import object FatherNamespace="Data", Constructor=True, ) -class PointsPy(object): +class Points(object): """ Points() -- Create an empty points object. diff --git a/src/Mod/Points/App/PointsPy.xml b/src/Mod/Points/App/PointsPy.xml deleted file mode 100644 index 0ab784731d..0000000000 --- a/src/Mod/Points/App/PointsPy.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - Points() -- Create an empty points object. - -This class allows one to manipulate the Points object by adding new points, deleting facets, importing from an STL file, -transforming and much more. - - - - - - Create a copy of this points object - - - - - Read in a points object from file. - - - - - Write the points object into file. - - - - - Write the points in OpenInventor format to a string. - - - - - add one or more (list of) points to the object - - - - - Get a new point object from a given segment - - - - - Get a new point object from points with valid coordinates (i.e. that are not NaN) - - - - - Return the number of vertices of the points object. - - - - - - A collection of points -With this attribute it is possible to get access to the points of the object - -for p in pnt.Points: - print p - - - - - - diff --git a/src/Tools/bindings/templates/templateClassPyExport.py b/src/Tools/bindings/templates/templateClassPyExport.py index 860a9a762a..19b6ceb422 100644 --- a/src/Tools/bindings/templates/templateClassPyExport.py +++ b/src/Tools/bindings/templates/templateClassPyExport.py @@ -44,8 +44,12 @@ class TemplateClassPyExport(template.ModelTemplate): "CAM", "Fem", "Gui", + "Import", + "Measure", + "Mesh", "Part", "PartDesign", + "Points", "Material", "Sketcher", ]: