From: mbs Date: Tue, 27 Jun 2023 15:35:45 +0000 (+0100) Subject: updated patch for almost planar faces not being created in IfcOpenShell X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de1212eea25e092d64b7a2ce3b4bb5437390c565;p=tools%2Fsat_salome.git updated patch for almost planar faces not being created in IfcOpenShell --- diff --git a/products/patches/IfcOpenShell_OCC.patch b/products/patches/IfcOpenShell_OCC.patch index 610dbaa..a779dcb 100755 --- a/products/patches/IfcOpenShell_OCC.patch +++ b/products/patches/IfcOpenShell_OCC.patch @@ -1,3 +1,66 @@ +diff --git a/src/ifcgeom/IfcGeomFaces.cpp b/src/ifcgeom/IfcGeomFaces.cpp +index 5626864..ba86e07 100644 +--- a/src/ifcgeom/IfcGeomFaces.cpp ++++ b/src/ifcgeom/IfcGeomFaces.cpp +@@ -53,12 +53,15 @@ + #include + #include + ++#include ++ + #include + #include + + #include + #include + ++#include + #include + #include + #include +@@ -221,6 +224,42 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) { + mf = new BRepBuilderAPI_MakeFace(pln, wire, true); + } else { + mf = new BRepBuilderAPI_MakeFace(wire); ++ if (!mf->IsDone()) { ++ Standard_Boolean isPlanarWanted = Standard_True; ++ // Find a deviation ++ Standard_Real aToleranceReached, aTol; ++ BRepLib_FindSurface aFS; ++ aFS.Init(wire, -1., isPlanarWanted); ++ aToleranceReached = aFS.ToleranceReached(); ++ aTol = aFS.Tolerance(); ++ if (!aFS.Found()) { ++ aFS.Init(wire, aToleranceReached, isPlanarWanted); ++ if (aFS.Found()) { ++ aToleranceReached = aFS.ToleranceReached(); ++ aTol = aFS.Tolerance(); ++ } ++ } ++ aTol = Max(1.2 * aToleranceReached, aTol); ++ ++ // Copy the wire, because it can be updated with very-very big tolerance here ++ BRepBuilderAPI_Copy aMC (wire); ++ if (aMC.IsDone()) { ++ TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape()); ++ // Update tolerances to ++ BRep_Builder B; ++ for (TopExp_Explorer expE (aWire, TopAbs_EDGE); expE.More(); expE.Next()) { ++ TopoDS_Edge anE = TopoDS::Edge(expE.Current()); ++ B.UpdateEdge(anE, aTol); ++ } ++ for (TopExp_Explorer expV (aWire, TopAbs_VERTEX); expV.More(); expV.Next()) { ++ TopoDS_Vertex aV = TopoDS::Vertex(expV.Current()); ++ B.UpdateVertex(aV, aTol); ++ } ++ // Build face ++ delete mf; ++ mf = new BRepBuilderAPI_MakeFace(aWire, isPlanarWanted); ++ } ++ } + } + } else { + /// @todo check necessity of false here diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index a3ac68c..fc988bd 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp