diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx index ac7176133..5b6ab865a 100644 --- a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx @@ -83,6 +83,27 @@ #define PLANAR_FACE_MAX_TOLERANCE 1e-06 +// The following macro, when enabled, causes pcurves upgrade after MakeFilling algorithm +// in MakeAnyFace function; +// WARNING: it may lead to extra vertices generation by partition algorithm +// in some cases, for example when fillet is made on a PipeTShape - +// see issues 0021568 and 0021550 +// VSR (15/05/2012): macro commented out (disabled) to avoid extra vertices! +//#define MAKE_FACE_UPGRADE_PCURVES + +// The following macro, when enabled, causes fixing tolerance for pcurves +// after BRepBuilderAPI_MakeFace + ShHealOper_ShapeProcess in MakeAnyFace function; +// This sometimes allows to fix problems of extra vertices generation +// see issue 0022706 +// VSR (17/11/2014): macro enabled +#define MAKE_FACE_PCURVES_FIX_TOLERANCE + +#ifdef MAKE_FACE_PCURVES_FIX_TOLERANCE +#include +#include +#include +#endif + static Standard_Integer mod4 (Standard_Integer nb) { if (nb <= 0) return nb + 4; @@ -1362,11 +1383,7 @@ TCollection_AsciiString GEOMImpl_Block6Explorer::MakeAnyFace (const TopoDS_Wire& // 12.04.2006 for PAL12149 begin Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFace)); -// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN -// the following block, when enabled, leads to extra vertices generation by partition algorithm -// in some cases, for example when fillet is made on a PipeTShape -#if 0 -// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END +#ifdef MAKE_FACE_UPGRADE_PCURVES BRep_Builder BB; TopoDS_Iterator itw(theWire); for (; itw.More(); itw.Next()) @@ -1396,7 +1413,44 @@ TCollection_AsciiString GEOMImpl_Block6Explorer::MakeAnyFace (const TopoDS_Wire& } // 12.04.2006 for PAL12149 end - if (theResult.IsNull()) { // try to deal with pure result of filling + if (!theResult.IsNull()) { + // try to deal with result of BRepBuilderAPI_MakeFace + ShHealOper_ShapeProcess +#ifdef MAKE_FACE_PCURVES_FIX_TOLERANCE + // check and fix pcurves, if necessary + Standard_Real aT, aTolE, aD, aDMax; + TopExp_Explorer aExpF, aExpE; + NCollection_DataMap aDMETol; + aExpF.Init(theResult, TopAbs_FACE); + for (; aExpF.More(); aExpF.Next()) { + const TopoDS_Face& aF = *(TopoDS_Face*)&aExpF.Current(); + aExpE.Init(aF, TopAbs_EDGE); + for (; aExpE.More(); aExpE.Next()) { + const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExpE.Current(); + if (!BOPTools_AlgoTools::ComputeTolerance(aF, aE, aDMax, aT)) continue; + aTolE = BRep_Tool::Tolerance(aE); + if (aDMax < aTolE) continue; + if (aDMETol.IsBound(aE)) { + aD = aDMETol.Find(aE); + if (aDMax > aD) { + aDMETol.UnBind(aE); + aDMETol.Bind(aE, aDMax); + } + } + else { + aDMETol.Bind(aE, aDMax); + } + } + } + NCollection_DataMap::Iterator aDMETolIt(aDMETol); + ShapeFix_ShapeTolerance sat; + for (; aDMETolIt.More(); aDMETolIt.Next()) { + sat.LimitTolerance(aDMETolIt.Key(), aDMETolIt.Value()); + } +#endif + } + else { + // try to deal with pure result of BRepOffsetAPI_MakeFilling + // Update tolerance Standard_Real aTol = MF.G0Error();