+ FEM: get nodes by vertex
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
#include <Mod/Part/App/TopoShapeFacePy.h>
|
||||
#include <Mod/Part/App/TopoShapeEdgePy.h>
|
||||
#include <Mod/Part/App/TopoShapeVertexPy.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
#include "Mod/Fem/App/FemMesh.h"
|
||||
@@ -558,7 +559,6 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::getNodesByEdge(PyObject *args)
|
||||
@@ -587,7 +587,34 @@ PyObject* FemMeshPy::getNodesByEdge(PyObject *args)
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::getNodesByVertex(PyObject *args)
|
||||
{
|
||||
PyObject *pW;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapeVertexPy::Type), &pW))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapeVertexPy*>(pW)->getTopoShapePtr()->_Shape;
|
||||
const TopoDS_Vertex& fc = TopoDS::Vertex(sh);
|
||||
if (sh.IsNull()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Vertex is empty");
|
||||
return 0;
|
||||
}
|
||||
Py::List ret;
|
||||
std::set<long> resultSet = getFemMeshPtr()->getNodesByVertex(fc);
|
||||
for (std::set<long>::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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user