+ expose function to Python to check for invalid mesh points
This commit is contained in:
parent
267ca0813a
commit
ae09625140
|
@ -1195,6 +1195,12 @@ void MeshObject::removeFullBoundaryFacets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MeshObject::hasInvalidPoints() const
|
||||||
|
{
|
||||||
|
MeshCore::MeshEvalNaNPoints nan(_kernel);
|
||||||
|
return !nan.GetIndices().empty();
|
||||||
|
}
|
||||||
|
|
||||||
void MeshObject::removeInvalidPoints()
|
void MeshObject::removeInvalidPoints()
|
||||||
{
|
{
|
||||||
MeshCore::MeshEvalNaNPoints nan(_kernel);
|
MeshCore::MeshEvalNaNPoints nan(_kernel);
|
||||||
|
|
|
@ -268,6 +268,7 @@ public:
|
||||||
void removeSelfIntersections(const std::vector<unsigned long>&);
|
void removeSelfIntersections(const std::vector<unsigned long>&);
|
||||||
void removeFoldsOnSurface();
|
void removeFoldsOnSurface();
|
||||||
void removeFullBoundaryFacets();
|
void removeFullBoundaryFacets();
|
||||||
|
bool hasInvalidPoints() const;
|
||||||
void removeInvalidPoints();
|
void removeInvalidPoints();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -72,5 +72,10 @@ d.addObject(\"Mesh::Feature\").
|
||||||
<UserDocu>Remove folds on surfaces</UserDocu>
|
<UserDocu>Remove folds on surfaces</UserDocu>
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</Methode>
|
</Methode>
|
||||||
|
<Methode Name="removeInvalidPoints">
|
||||||
|
<Documentation>
|
||||||
|
<UserDocu>Remove points with invalid coordinates (NaN)</UserDocu>
|
||||||
|
</Documentation>
|
||||||
|
</Methode>
|
||||||
</PythonExport>
|
</PythonExport>
|
||||||
</GenerateModel>
|
</GenerateModel>
|
||||||
|
|
|
@ -191,6 +191,23 @@ PyObject* MeshFeaturePy::removeFoldsOnSurface(PyObject *args)
|
||||||
Py_Return;
|
Py_Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* MeshFeaturePy::removeInvalidPoints(PyObject *args)
|
||||||
|
{
|
||||||
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
|
return NULL;
|
||||||
|
try {
|
||||||
|
Mesh::Feature* obj = getFeaturePtr();
|
||||||
|
MeshObject* kernel = obj->Mesh.startEditing();
|
||||||
|
kernel->removeInvalidPoints();
|
||||||
|
obj->Mesh.finishEditing();
|
||||||
|
}
|
||||||
|
catch (const Base::Exception& e) {
|
||||||
|
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_Return;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *MeshFeaturePy::getCustomAttributes(const char* /*attr*/) const
|
PyObject *MeshFeaturePy::getCustomAttributes(const char* /*attr*/) const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -232,6 +232,16 @@ for c in mesh.getSeparatecomponents():
|
||||||
<UserDocu>Get the number of wrong oriented facets</UserDocu>
|
<UserDocu>Get the number of wrong oriented facets</UserDocu>
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</Methode>
|
</Methode>
|
||||||
|
<Methode Name="hasInvalidPoints" Const="true">
|
||||||
|
<Documentation>
|
||||||
|
<UserDocu>Check if the mesh has points with invalid coordinates (NaN)</UserDocu>
|
||||||
|
</Documentation>
|
||||||
|
</Methode>
|
||||||
|
<Methode Name="removeInvalidPoints">
|
||||||
|
<Documentation>
|
||||||
|
<UserDocu>Remove points with invalid coordinates (NaN)</UserDocu>
|
||||||
|
</Documentation>
|
||||||
|
</Methode>
|
||||||
<Methode Name="countComponents" Const="true">
|
<Methode Name="countComponents" Const="true">
|
||||||
<Documentation>
|
<Documentation>
|
||||||
<UserDocu>Get the number of topologic independent areas</UserDocu>
|
<UserDocu>Get the number of topologic independent areas</UserDocu>
|
||||||
|
|
|
@ -833,6 +833,28 @@ PyObject* MeshPy::removeFoldsOnSurface(PyObject *args)
|
||||||
Py_Return;
|
Py_Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* MeshPy::hasInvalidPoints(PyObject *args)
|
||||||
|
{
|
||||||
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
|
return NULL;
|
||||||
|
bool ok = getMeshObjectPtr()->hasInvalidPoints();
|
||||||
|
return Py_BuildValue("O", (ok ? Py_True : Py_False));
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* MeshPy::removeInvalidPoints(PyObject *args)
|
||||||
|
{
|
||||||
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
|
return NULL;
|
||||||
|
try {
|
||||||
|
getMeshObjectPtr()->removeInvalidPoints();
|
||||||
|
}
|
||||||
|
catch (const Base::Exception& e) {
|
||||||
|
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_Return;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject* MeshPy::flipNormals(PyObject *args)
|
PyObject* MeshPy::flipNormals(PyObject *args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ""))
|
if (!PyArg_ParseTuple(args, ""))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user