From: snn Date: Tue, 13 Jun 2017 06:48:24 +0000 (+0300) Subject: Skip call of BRepLib_MakeFace for non-linear edges X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR0_691_FixCMT;p=occt-copy.git Skip call of BRepLib_MakeFace for non-linear edges --- diff --git a/src/BRepOffset/BRepOffset_MakeSimpleOffset.cxx b/src/BRepOffset/BRepOffset_MakeSimpleOffset.cxx index 8617ee072f..43095cba00 100644 --- a/src/BRepOffset/BRepOffset_MakeSimpleOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeSimpleOffset.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -421,6 +422,18 @@ Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls(const BRepTools_ return Standard_True; } +// used in BuildWallFace +static Standard_Boolean isLinear(const TopoDS_Edge& theEdge) +{ + Standard_Real aU1, aU2; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aU1, aU2); + while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) + { + aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); + } + return !aCurve.IsNull() && aCurve->IsKind(STANDARD_TYPE(Geom_Line)); +} + //============================================================================= //function : BuildWallFace //purpose : @@ -505,15 +518,18 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const BRepTools_Modifier& // Try to build using simple planar approach. TopoDS_Face aF; - try - { - // Call of face maker is wrapped by try/catch since it generates exceptions sometimes. - BRepLib_MakeFace aFM(aWire, Standard_True); - if (aFM.IsDone()) - aF = aFM.Face(); - } - catch(Standard_Failure) + if (isLinear(anOrigCopy) && isLinear(aWall1) && isLinear(aNewEdge) && isLinear(aWall2)) { + try + { + // Call of face maker is wrapped by try/catch since it generates exceptions sometimes. + BRepLib_MakeFace aFM(aWire, Standard_True); + if (aFM.IsDone()) + aF = aFM.Face(); + } + catch (Standard_Failure) + { + } } if (aF.IsNull()) // Exception in face maker or result is not computed.