Skip to content

Commit

Permalink
Mesh: [skip ci] allow to pass target number to Python function Mesh.d…
Browse files Browse the repository at this point in the history
…ecimate()
  • Loading branch information
wwmayer committed May 3, 2020
1 parent 1d0664d commit 84f9b9d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Mod/Mesh/App/MeshPyImp.cpp
Expand Up @@ -1726,14 +1726,26 @@ PyObject* MeshPy::smooth(PyObject *args, PyObject *kwds)
PyObject* MeshPy::decimate(PyObject *args)
{
float fTol, fRed;
if (!PyArg_ParseTuple(args, "ff", &fTol,&fRed))
return NULL;
if (PyArg_ParseTuple(args, "ff", &fTol,&fRed)) {
PY_TRY {
getMeshObjectPtr()->decimate(fTol, fRed);
} PY_CATCH;

PY_TRY {
getMeshObjectPtr()->decimate(fTol, fRed);
} PY_CATCH;
Py_Return;
}

Py_Return;
PyErr_Clear();
int targetSize;
if (PyArg_ParseTuple(args, "i", &targetSize)) {
PY_TRY {
getMeshObjectPtr()->decimate(targetSize);
} PY_CATCH;

Py_Return;
}

PyErr_SetString(PyExc_ValueError, "decimate(tolerance=float, reduction=float) or decimate(targetSize=int)");
return nullptr;
}

PyObject* MeshPy::nearestFacetOnRay(PyObject *args)
Expand Down

0 comments on commit 84f9b9d

Please sign in to comment.