From 9295c4d838b6fba3e9da091b251fa9bdd7e47360 Mon Sep 17 00:00:00 2001 From: msv Date: Mon, 20 Jun 2016 18:18:24 +0300 Subject: [PATCH] Check status of BOPAlgo_Builder before using its result. --- src/BRepOffset/BRepOffset_MakeOffset.cxx | 79 +++++++++++++++--------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx index a821c3e2b0..bbc74601aa 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx @@ -4173,6 +4173,8 @@ void IntersectTrimmedEdges(const TopTools_ListOfShape& theLF, // aGFE.SetArguments(aLS); aGFE.Perform(); + if (aGFE.ErrorStatus()) + return; TopTools_ListOfShape aLA; // fill map with edges images aIt.Initialize(aLS); @@ -5081,6 +5083,8 @@ void IntersectAndTrimEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theF // aGF.SetArguments(aLArgs); aGF.Perform(); + if (aGF.ErrorStatus()) + return; // // update vertices to avoid with sd vertices aIt.Initialize(aLVBounds); @@ -7688,40 +7692,41 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE, aGFE.AddArgument(aV2); // aGFE.Perform(); - // - // get images of bounding vertices to remove splits containing them - const TopTools_ListOfShape& aLV1Im = aGFE.Modified(aV1); - const TopTools_ListOfShape& aLV2Im = aGFE.Modified(aV2); - // - if (aLV1Im.Extent()) { - aMEVBounds.Add(aLV1Im.First()); - } - else { - aMEVBounds.Add(aV1); - } - // - if (aLV2Im.Extent()) { - aMEVBounds.Add(aLV2Im.First()); - } - else { - aMEVBounds.Add(aV2); - } - // + if (aGFE.ErrorStatus() == 0) { - TopTools_MapIteratorOfMapOfShape aItM(theMVBounds); - for (; aItM.More(); aItM.Next()) { - const TopoDS_Shape& aV = aItM.Key(); - const TopTools_ListOfShape& aLVIm = aGFE.Modified(aV); - if (aLVIm.Extent()) { - aMEVBounds.Add(aLVIm.First()); - } - else { - aMEVBounds.Add(aV); + // get images of bounding vertices to remove splits containing them + const TopTools_ListOfShape& aLV1Im = aGFE.Modified(aV1); + if (aLV1Im.Extent()) { + aMEVBounds.Add(aLV1Im.First()); + } + else { + aMEVBounds.Add(aV1); + } + // + const TopTools_ListOfShape& aLV2Im = aGFE.Modified(aV2); + if (aLV2Im.Extent()) { + aMEVBounds.Add(aLV2Im.First()); + } + else { + aMEVBounds.Add(aV2); + } + // + { + TopTools_MapIteratorOfMapOfShape aItM(theMVBounds); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aV = aItM.Key(); + const TopTools_ListOfShape& aLVIm = aGFE.Modified(aV); + if (aLVIm.Extent()) { + aMEVBounds.Add(aLVIm.First()); + } + else { + aMEVBounds.Add(aV); + } } } + // + aCEIm = aGFE.Shape(); } - // - aCEIm = aGFE.Shape(); } else { aCEIm = aLEIm.First(); @@ -7781,6 +7786,20 @@ void IntersectEdges(const BOPCol_ListOfShape& theLA, BOPAlgo_Builder aGFA; aGFA.SetArguments(theLA); aGFA.Perform(); + if (aGFA.ErrorStatus()) + { + // just copy input to the result + TopoDS_Compound aSp; + BRep_Builder aBB; + aBB.MakeCompound(aSp); + BOPCol_ListOfShape::Iterator anIt(theLA); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aE = anIt.Value(); + aBB.Add(aSp, aE); + } + theSplits = aSp; + return; + } // UpdateImages(theLE, theEImages, aGFA, theModifiedEdges); // -- 2.39.5