From f71ee35f577dd8658b1f71b48d84db9b92c2a626 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 3 Apr 2017 14:55:34 +0200 Subject: [PATCH] More 'tolerant' to tolerances higher than the modeling precision --- src/ifcgeom/IfcGeomFunctions.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index d3007be688..71c742a155 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -122,6 +122,7 @@ #include #include #include +#include #include #include @@ -716,8 +717,18 @@ gp_Pnt IfcGeom::Kernel::point_above_plane(const gp_Pln& pln, bool agree) { } void IfcGeom::Kernel::apply_tolerance(TopoDS_Shape& s, double t) { + ShapeAnalysis_ShapeTolerance toler; + if (toler.Tolerance(s, 0) > t) { + Handle_TopTools_HSequenceOfShape shapes = toler.OverTolerance(s, t); + for (int i = 1; i <= shapes->Length(); ++i) { + const TopoDS_Shape& sub = shapes->Value(i); + std::stringstream ss; + TopAbs::Print(sub.ShapeType(), ss); + Logger::Warning("Tolerance of " + boost::lexical_cast(toler.Tolerance(sub, 0)) + " on " + ss.str()); + } + } ShapeFix_ShapeTolerance tol; - tol.SetTolerance(s, t); + tol.LimitTolerance(s, t); } void IfcGeom::Kernel::setValue(GeomValue var, double value) {