]> OCCT Git - occt.git/commitdiff
0028221: General Fuse operation error
authormsv <msv@opencascade.com>
Thu, 22 Dec 2016 09:43:48 +0000 (12:43 +0300)
committerapn <apn@opencascade.com>
Thu, 22 Dec 2016 09:44:05 +0000 (12:44 +0300)
The method BOPTools_AlgoTools2D::AttachExistingPCurve has been corrected so that
to call BRepLib::SameParameter not on the target edge with the whole set of pcurves,
but rather on a temporary edge with 3D curve and copied pcurve only.
After that the updated pcurve is transferred to the target edge.

Small correction of test case for issue CR28221

src/BOPTools/BOPTools_AlgoTools2D_1.cxx
tests/bugs/modalg_6/bug28221 [new file with mode: 0644]

index 667db5c5366ea25425c10fbae1b9955184c897b0..0434b142f00967be3bf4563de0cac78cbdcc808e 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 
+#include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
 
@@ -127,21 +128,39 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
     return iRet;
   }
   //
-  aBB.SameRange(aE1, Standard_False);
-  aBB.SameParameter(aE1, Standard_False);
-  //
-  aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
-  BRepLib::SameParameter(aE1);
-  BRepLib::SameRange(aE1);
+  // create a temporary edge to make same parameter pcurve
+  TopoDS_Edge aE1T;
+  aBB.MakeEdge(aE1T, aCE1, aTol);
+  aBB.Range(aE1T, aT11, aT12);
+  aBB.SameRange(aE1T, Standard_False);
+  aBB.SameParameter(aE1T, Standard_False);
+  //
+  aBB.UpdateEdge(aE1T, aC2DT, aF, aTol);
+  try {
+    BRepLib::SameParameter(aE1T);
+    BRepLib::SameRange(aE1T);
+  }
+  catch (Standard_Failure)
+  {
+    iRet = 6;
+    return iRet;
+  }
   //
   bIsClosed = IsClosed(aE2, aF);
   if (bIsClosed) {
-    iRet = UpdateClosedPCurve(aE2, aE1, aF, aCtx);
+    iRet = UpdateClosedPCurve(aE2, aE1T, aF, aCtx);
     if(iRet) {
       iRet = 5;
+      return iRet;
     }
   }
-  //
+  // transfer pcurve(s) from the temporary edge to the new edge
+  aBB.Transfert(aE1T, aE1);
+  // update tolerance of vertices
+  Standard_Real aNewTol = BRep_Tool::Tolerance(aE1T);
+  TopoDS_Iterator it(aE1);
+  for (; it.More(); it.Next())
+    aBB.UpdateVertex(TopoDS::Vertex(it.Value()), aNewTol);
   return iRet;
 }
 //=======================================================================
diff --git a/tests/bugs/modalg_6/bug28221 b/tests/bugs/modalg_6/bug28221
new file mode 100644 (file)
index 0000000..67ec2a8
--- /dev/null
@@ -0,0 +1,23 @@
+puts "========"
+puts "OCC28221"
+puts "========"
+puts ""
+#################################################
+# General Fuse operation error
+#################################################
+
+restore [locate_data_file bug28221_shape.brep] a
+
+explode a
+bclearobjects
+bcleartools
+baddobjects a_1
+baddtools a_2
+bfillds
+bbuild result
+
+checkshape result
+checknbshapes result -solid 10
+checkprops result -v 0.201442 -s 6.13063
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file