0030897: Modeling Algorithms - Crash in UnifySameDomain [Regression]
authormsv <msv@opencascade.com>
Tue, 13 Aug 2019 13:00:48 +0000 (16:00 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 16 Aug 2019 09:16:40 +0000 (12:16 +0300)
The regression caused by the patch for 0030534 has been eliminated. For that the method InsertWiresIntoFaces() has been corrected: the face to which a wire is added is first oriented as forward.

src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
tests/bugs/modalg_7/bug30897 [new file with mode: 0644]

index 4d41721..6489c4e 100644 (file)
@@ -377,7 +377,7 @@ static void InsertWiresIntoFaces(const TopTools_SequenceOfShape& theWires,
     const TopoDS_Edge& anEdge = TopoDS::Edge(iter.Value());
     BRepAdaptor_Curve2d BAcurve2d(anEdge, theRefFace);
     gp_Pnt2d aPnt2d = BAcurve2d.Value((BAcurve2d.FirstParameter() + BAcurve2d.LastParameter())/2.);
-    TopoDS_Face RequiredFace;
+    TopoDS_Shape RequiredFace;
     for (Standard_Integer jj = 1; jj <= theFaces.Length(); jj++)
     {
       const TopoDS_Face& aFace = TopoDS::Face(theFaces(jj));
@@ -385,11 +385,18 @@ static void InsertWiresIntoFaces(const TopTools_SequenceOfShape& theWires,
       TopAbs_State aStatus = Classifier.Perform(aPnt2d);
       if (aStatus == TopAbs_IN)
       {
-        RequiredFace = aFace;
+        RequiredFace = aFace.Oriented (TopAbs_FORWARD);
         break;
       }
     }
-    BB.Add(RequiredFace, aWire);
+    if (!RequiredFace.IsNull())
+    {
+      BB.Add(RequiredFace, aWire);
+    }
+    else
+    {
+      Standard_ASSERT_INVOKE ("ShapeUpgrade_UnifySameDomain: wire remains unclassified");
+    }
   }
 }
 
diff --git a/tests/bugs/modalg_7/bug30897 b/tests/bugs/modalg_7/bug30897
new file mode 100644 (file)
index 0000000..3d33854
--- /dev/null
@@ -0,0 +1,20 @@
+puts "======================================================="
+puts "0030897: Modeling Algorithms - Crash in UnifySameDomain"
+puts "======================================================="
+puts ""
+
+restore [locate_data_file bug30897_bleriot_16.brep] a
+
+unifysamedom result a
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 51 -wire 121 -edge 379 -vertex 324
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.00385} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 403016