add python binding of OCC defeaturing

This commit is contained in:
tomate44
2018-07-03 13:44:52 +02:00
committed by wmayer
parent 607a6c122b
commit 8d177f3caf
2 changed files with 33 additions and 0 deletions

View File

@@ -2650,6 +2650,33 @@ PyObject* TopoShapePy::optimalBoundingBox(PyObject *args)
}
}
PyObject* TopoShapePy::defeaturing(PyObject *args)
{
PyObject *l;
if (!PyArg_ParseTuple(args, "O",&l))
return NULL;
try {
Py::Sequence list(l);
std::vector<TopoDS_Shape> shapes;
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
Py::TopoShape sh(*it);
shapes.push_back(
sh.extensionObject()->getTopoShapePtr()->getShape()
);
}
PyTypeObject* type = this->GetType();
PyObject* inst = type->tp_new(type, this, 0);
static_cast<TopoShapePy*>(inst)->getTopoShapePtr()->setShape
(this->getTopoShapePtr()->defeaturing(shapes));
return inst;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return NULL;
}
}
// End of Methods, Start of Attributes
#if 0 // see ComplexGeoDataPy::Matrix which does the same