FEM: add getNodesBySolid()

Conflicts:
	src/Mod/Fem/App/FemMesh.cpp
This commit is contained in:
Bernd Hahnebach
2015-04-21 21:29:39 +02:00
committed by Yorik van Havre
parent 3724748d06
commit accb05c502
4 changed files with 76 additions and 0 deletions

View File

@@ -38,6 +38,7 @@
#include <Base/QuantityPy.h>
#include <Mod/Part/App/TopoShapePy.h>
#include <Mod/Part/App/TopoShapeSolidPy.h>
#include <Mod/Part/App/TopoShapeFacePy.h>
#include <Mod/Part/App/TopoShapeEdgePy.h>
#include <Mod/Part/App/TopoShapeVertexPy.h>
@@ -611,6 +612,34 @@ PyObject* FemMeshPy::getNodeById(PyObject *args)
}
}
PyObject* FemMeshPy::getNodesBySolid(PyObject *args)
{
PyObject *pW;
if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapeSolidPy::Type), &pW))
return 0;
try {
const TopoDS_Shape& sh = static_cast<Part::TopoShapeSolidPy*>(pW)->getTopoShapePtr()->_Shape;
const TopoDS_Solid& fc = TopoDS::Solid(sh);
if (sh.IsNull()) {
PyErr_SetString(Base::BaseExceptionFreeCADError, "Solid is empty");
return 0;
}
Py::List ret;
std::set<int> resultSet = getFemMeshPtr()->getNodesBySolid(fc);
for (std::set<int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
ret.append(Py::Int(*it));
return Py::new_reference_to(ret);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
}
PyObject* FemMeshPy::getNodesByFace(PyObject *args)
{
PyObject *pW;