Finish get nodes by surface
This commit is contained in:
parent
1341c43e5f
commit
cd69467ede
|
@ -29,7 +29,9 @@
|
|||
# include <strstream>
|
||||
# include <Bnd_Box.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepAlgo_NormalProjection.hxx>
|
||||
# include <BRepExtrema_DistShapeShape.hxx>
|
||||
# include <TopoDS_Vertex.hxx>
|
||||
# include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
# include <gp_Pnt.hxx>
|
||||
#endif
|
||||
|
||||
|
@ -408,6 +410,9 @@ std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Face &face)const
|
|||
|
||||
Bnd_Box box;
|
||||
BRepBndLib::Add(face, box);
|
||||
// limit where the mesh node belongs to the face:
|
||||
double limit = box.SquareExtent()/10000.0;
|
||||
box.Enlarge(limit);
|
||||
|
||||
// get the actuall transform of the FemMesh
|
||||
const Base::Matrix4D Mtrx(getTransform());
|
||||
|
@ -420,15 +425,21 @@ std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Face &face)const
|
|||
vec = Mtrx * vec;
|
||||
|
||||
if(!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))){
|
||||
// create a Vertex
|
||||
BRepBuilderAPI_MakeVertex aBuilder(gp_Pnt(vec.x,vec.y,vec.z));
|
||||
TopoDS_Shape s = aBuilder.Vertex();
|
||||
// measure distance
|
||||
BRepExtrema_DistShapeShape measure(face,s);
|
||||
measure.Perform();
|
||||
if (!measure.IsDone() || measure.NbSolution() < 1)
|
||||
continue;
|
||||
|
||||
result.insert(aNode->GetID());
|
||||
if(measure.Value() < limit)
|
||||
result.insert(aNode->GetID());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BRepAlgo_NormalProjection algo;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<UserDocu>Get the node position vector by an Node-ID</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getNodesByFace">
|
||||
<Methode Name="getNodesByFace" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Return a list of node IDs which belong to a TopoFace</UserDocu>
|
||||
</Documentation>
|
||||
|
|
|
@ -218,13 +218,14 @@ Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
|
|||
|
||||
void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
|
||||
{
|
||||
/* std::set<long>& nodeSet;
|
||||
for (Py::List::iterator it = arg.begin(); it != arg.end() && index < 16; ++it) {
|
||||
nodeSet.i (double)Py::Int(*it);
|
||||
}
|
||||
setHighlightNodes*/
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
std::set<long> res;
|
||||
|
||||
for( Py::List::iterator it = arg.begin(); it!= arg.end();++it){
|
||||
Py::Int id(*it);
|
||||
if(id)
|
||||
res.insert(id);
|
||||
}
|
||||
this->getViewProviderFemMeshPtr()->setHighlightNodes(res);
|
||||
}
|
||||
|
||||
Py::List ViewProviderFemMeshPy::getVisibleElementFaces(void) const
|
||||
|
|
Loading…
Reference in New Issue
Block a user