]> OCCT Git - occt-copy.git/commitdiff
0027521: Standard_ConstructionError when trying to use unifySameDom into a shape
authormsv <msv@opencascade.com>
Fri, 20 May 2016 08:36:11 +0000 (11:36 +0300)
committermsv <msv@opencascade.com>
Mon, 23 May 2016 11:49:41 +0000 (14:49 +0300)
Correct the algorithm in the function MergeEdges in ShapeUpgrade_UnifySameDomain.cxx so as to take into account the orientation of the next edge added to the chain.

Test cases for issue CR27521

src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
tests/bugs/modalg_6/bug27521_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug27521_2 [new file with mode: 0644]

index 85d56ab93d913f4f418d857fe82afbc482812884..cd2d0a6e3bdb1be69e0d7ece9a2c4aaee81bc8cc 100644 (file)
@@ -873,16 +873,20 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
           edge = TopoDS::Edge(itL.Value());
           if (!aUsedEdges.Contains(edge))
           {
-            if (j == 0)
-              aChain.Prepend(edge);
-            else
-              aChain.Append(edge);
-            aUsedEdges.Add(edge);
-            TopoDS_Vertex VF2, VL2;
-            TopExp::Vertices(edge, VF2, VL2, Standard_True);
-            V[j] = (VF2.IsSame(V[j]) ? VL2 : VF2);
-            isAdded = Standard_True;
-            break;
+            TopoDS_Vertex V2[2];
+            TopExp::Vertices(edge, V2[0], V2[1], Standard_True);
+            // the neighboring edge must have V[j] reversed and located on the opposite end
+            if (V2[1 - j].IsEqual(V[j].Reversed()))
+            {
+              if (j == 0)
+                aChain.Prepend(edge);
+              else
+                aChain.Append(edge);
+              aUsedEdges.Add(edge);
+              V[j] = V2[j];
+              isAdded = Standard_True;
+              break;
+            }
           }
         }
       }
diff --git a/tests/bugs/modalg_6/bug27521_1 b/tests/bugs/modalg_6/bug27521_1
new file mode 100644 (file)
index 0000000..d47ae3d
--- /dev/null
@@ -0,0 +1,15 @@
+puts "============"
+puts "OCC27521"
+puts "============"
+puts ""
+###############################
+## Standard_ConstructionError when trying to use unifySameDom into a shape
+###############################
+
+restore [locate_data_file bug27521_dom8443-good.brep] a
+unifysamedom result a
+
+don result
+smallview; fit
+checkshape result
+checknbshapes result -m UnifySameDomain -face 31 -edge 286
diff --git a/tests/bugs/modalg_6/bug27521_2 b/tests/bugs/modalg_6/bug27521_2
new file mode 100644 (file)
index 0000000..deed5e9
--- /dev/null
@@ -0,0 +1,15 @@
+puts "============"
+puts "OCC27521"
+puts "============"
+puts ""
+###############################
+## Standard_ConstructionError when trying to use unifySameDom into a shape
+###############################
+
+restore [locate_data_file bug27521_dom8443-wrong.brep] a
+unifysamedom result a
+
+don result
+smallview; fit
+checkshape result
+checknbshapes result -m UnifySameDomain -face 31 -edge 286