Get node of face implementation
This commit is contained in:
parent
1ec10333f2
commit
1341c43e5f
|
@ -30,6 +30,7 @@
|
|||
# include <Bnd_Box.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepAlgo_NormalProjection.hxx>
|
||||
# include <gp_Pnt.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Writer.h>
|
||||
|
@ -326,6 +327,7 @@ SMESH_Mesh* FemMesh::getSMesh()
|
|||
return myMesh;
|
||||
}
|
||||
|
||||
|
||||
SMESH_Gen * FemMesh::getGenerator()
|
||||
{
|
||||
return myGen;
|
||||
|
@ -404,6 +406,26 @@ std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Face &face)const
|
|||
std::set<long> result;
|
||||
const SMESHDS_Mesh* data = myMesh->GetMeshDS();
|
||||
|
||||
Bnd_Box box;
|
||||
BRepBndLib::Add(face, box);
|
||||
|
||||
// get the actuall transform of the FemMesh
|
||||
const Base::Matrix4D Mtrx(getTransform());
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator();
|
||||
for (int i=0;aNodeIter->more();i++) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z());
|
||||
// Apply the matrix to hold the BoundBox in absolute space.
|
||||
vec = Mtrx * vec;
|
||||
|
||||
if(!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))){
|
||||
|
||||
result.insert(aNode->GetID());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BRepAlgo_NormalProjection algo;
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Base/MatrixPy.h>
|
||||
|
@ -534,13 +535,17 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
|
|||
|
||||
try {
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapeFacePy*>(pW)->getTopoShapePtr()->_Shape;
|
||||
const TopoDS_Face& fc = TopoDS::Face(sh);
|
||||
if (sh.IsNull()) {
|
||||
PyErr_SetString(PyExc_Exception, "Face is empty");
|
||||
return 0;
|
||||
}
|
||||
Py::List ret;
|
||||
throw Py::Exception("Not yet implemented");
|
||||
|
||||
std::set<long> resultSet = getFemMeshPtr()->getSurfaceNodes(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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user