diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index f3347c8b32..26b7666be7 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -1497,6 +1497,30 @@ void MeshObject::validateIndices() this->_segments.clear(); } +bool MeshObject::hasInvalidNeighbourhood() const +{ + MeshCore::MeshEvalNeighbourhood eval(_kernel); + return !eval.Evaluate(); +} + +bool MeshObject::hasPointsOutOfRange() const +{ + MeshCore::MeshEvalRangePoint eval(_kernel); + return !eval.Evaluate(); +} + +bool MeshObject::hasFacetsOutOfRange() const +{ + MeshCore::MeshEvalRangeFacet eval(_kernel); + return !eval.Evaluate(); +} + +bool MeshObject::hasCorruptedFacets() const +{ + MeshCore::MeshEvalCorruptedFacets eval(_kernel); + return !eval.Evaluate(); +} + void MeshObject::validateDeformations(float fMaxAngle, float fEps) { unsigned long count = _kernel.CountFacets(); diff --git a/src/Mod/Mesh/App/Mesh.h b/src/Mod/Mesh/App/Mesh.h index bcb2148948..1086ee01a5 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -283,6 +283,10 @@ public: void removeDuplicatedPoints(); void removeDuplicatedFacets(); bool hasNonManifolds() const; + bool hasInvalidNeighbourhood() const; + bool hasPointsOutOfRange() const; + bool hasFacetsOutOfRange() const; + bool hasCorruptedFacets() const; void removeNonManifolds(); void removeNonManifoldPoints(); bool hasSelfIntersections() const; diff --git a/src/Mod/Mesh/App/MeshPy.xml b/src/Mod/Mesh/App/MeshPy.xml index a43402f289..fdaad6cf92 100644 --- a/src/Mod/Mesh/App/MeshPy.xml +++ b/src/Mod/Mesh/App/MeshPy.xml @@ -229,7 +229,7 @@ for c in mesh.getSeparatecomponents(): Check if the mesh has non-manifolds - + Remove non-manifolds @@ -284,7 +284,27 @@ for c in mesh.getSeparatecomponents(): Remove points with invalid coordinates (NaN) - + + + 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 diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index 394a2ed88e..c984ffe3a8 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -972,6 +972,38 @@ PyObject* MeshPy::hasNonManifolds(PyObject *args) return Py_BuildValue("O", (ok ? Py_True : Py_False)); } +PyObject* MeshPy::hasInvalidNeighbourhood(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + bool ok = getMeshObjectPtr()->hasInvalidNeighbourhood(); + return Py_BuildValue("O", (ok ? Py_True : Py_False)); +} + +PyObject* MeshPy::hasPointsOutOfRange(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + bool ok = getMeshObjectPtr()->hasPointsOutOfRange(); + return Py_BuildValue("O", (ok ? Py_True : Py_False)); +} + +PyObject* MeshPy::hasFacetsOutOfRange(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + bool ok = getMeshObjectPtr()->hasFacetsOutOfRange(); + return Py_BuildValue("O", (ok ? Py_True : Py_False)); +} + +PyObject* MeshPy::hasCorruptedFacets(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + bool ok = getMeshObjectPtr()->hasFacetsOutOfRange(); + return Py_BuildValue("O", (ok ? Py_True : Py_False)); +} + PyObject* MeshPy::removeNonManifolds(PyObject *args) { if (!PyArg_ParseTuple(args, ""))