Salome HOME
[bos #28816] EDF 24678 - tolerance with wires
authorjfa <jfa@opencascade.com>
Fri, 4 Feb 2022 18:25:03 +0000 (21:25 +0300)
committerjfa <jfa@opencascade.com>
Fri, 4 Feb 2022 18:25:03 +0000 (21:25 +0300)
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx

index 60b9816ab38a1722798e609f820f91d68a809421..0a0709276b972d78974176237b51b607ee4e09f5 100644 (file)
@@ -1127,7 +1127,17 @@ TopoDS_Wire GEOMImpl_ShapeDriver::MakeWireFromEdges(const Handle(TColStd_HSequen
   }
 
   // IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance
-  aFW->ClosedWireMode() = Standard_False;
+  // aaajfa
+  bool isClosed = false;
+  Handle(ShapeAnalysis_Wire) asaw = aFW->Analyzer();
+  if (asaw->CheckGap3d(1)) { // between last and first edges
+    Standard_Real dist = asaw->MinDistance3d();
+    if (dist < theTolerance)
+      isClosed = true;
+  }
+  aFW->ClosedWireMode() = isClosed;
+  // aaajfa
+  //aFW->ClosedWireMode() = Standard_False;
   aFW->FixConnected(theTolerance);
   if (aFW->StatusConnected(ShapeExtend_FAIL)) {
     Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");