From a8c31221ede2cc147e102460d89bfa30a9c7da1b Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Fri, 8 Dec 2017 07:15:58 +0100 Subject: [PATCH] FEM: mesh api, fix tolerance in get the nodes by a solid --- src/Mod/Fem/App/FemMesh.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 753c7db80b..f521c95072 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -78,6 +78,8 @@ # include # include +# include + //to simplify parsing input files we use the boost lib #include @@ -715,10 +717,12 @@ std::set FemMesh::getNodesBySolid(const TopoDS_Solid &solid) const Bnd_Box box; BRepBndLib::Add(solid, box); - // limit where the mesh node belongs to the solid: - double limit = box.SquareExtent()/10000.0; - //double limit = BRep_Tool::Tolerance(solid); // does not compile --> no matching function for call to 'BRep_Tool::Tolerance(const TopoDS_Solid&)' - box.Enlarge(limit); + + // limit where the mesh node belongs to the solid + TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; + ShapeAnalysis_ShapeTolerance analysis; + double limit = analysis.Tolerance(solid, 1, shapetype); + Base::Console().Log("The limit if a node is in or out: %.12lf in scientific: %.4e \n", limit, limit); // get the current transform of the FemMesh const Base::Matrix4D Mtrx(getTransform());