]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp
Salome HOME
Copyright update 2022
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Fillet1D.cpp
index 344ac9415ee5535967dd0c9f720904d2a10bfc19..34673a7e9370764e1261e6c2267b51e1600286c6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020  CEA/DEN, EDF R&D
+// Copyright (C) 2020-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -73,6 +73,7 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire,
   if (!theBaseWire || theFilletVertices.empty() || theRadius < 0.)
     return;
 
+  myFailedVertices.clear();
   // store all edges of a base wire as modified, because they will be rebuild by ShapeFix
   for (GeomAPI_WireExplorer aWExp(theBaseWire->wire()); aWExp.more(); aWExp.next()) {
     GeomShapePtr aCurrent = aWExp.current();
@@ -109,11 +110,20 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire,
 
     // create fillet builder
     GEOMImpl_Fillet1d aFilletBuilder(anEdge1, anEdge2, aPlane->impl<gp_Pln>());
-    if (!aFilletBuilder.Perform(theRadius))
-      return; // fillet is failed, no way to continue
+    bool isOk = aFilletBuilder.Perform(theRadius);
+    TopoDS_Edge aFilletEdge;
+    if (isOk) {
+      GeomPointPtr aPoint = aVE->first->vertex()->point();
+      aFilletEdge = aFilletBuilder.Result(aPoint->impl<gp_Pnt>(), anEdge1, anEdge2);
+      isOk = !aFilletEdge.IsNull();
+    }
 
-    GeomPointPtr aPoint = aVE->first->vertex()->point();
-    TopoDS_Edge aFilletEdge = aFilletBuilder.Result(aPoint->impl<gp_Pnt>(), anEdge1, anEdge2);
+    if (!isOk) {
+      // something gone wrong and the fillet edge is not constructed,
+      // just store the failed vertex and continue
+      myFailedVertices.push_back(*aVIt);
+      continue;
+    }
 
     // store modified shapes
     myGenerated[aVE->first].push_back(convert(aFilletEdge));
@@ -149,8 +159,10 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire,
   aFixWire.ClosedWireMode() = aBaseWire->isClosed();
   aFixWire.FixReorder();
   aNewWire = aFixWire.WireAPIMake();
-  if (aNewWire.IsNull())
+  if (aNewWire.IsNull()) {
+    myFailedVertices = theFilletVertices;
     return;
+  }
 
   // update the map of modified shapes, because the edges are changed by ShapeFix
   for (BRepTools_WireExplorer anExp(aNewWire); anExp.More(); anExp.Next()) {
@@ -190,7 +202,7 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire,
   myModified[theBaseWire].push_back(aShape);
 
   setShape(aShape);
-  setDone(true);
+  setDone(myFailedVertices.empty());
 }
 
 void GeomAlgoAPI_Fillet1D::generated(const GeomShapePtr theOldShape,