0028471: ShapeUpgrade_RemoveLocations breaks sharing of sub-shapes
authormsv <msv@opencascade.com>
Fri, 17 Feb 2017 15:59:49 +0000 (18:59 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 2 Mar 2017 09:31:54 +0000 (12:31 +0300)
- Add option 'remove_level' to the command 'removeloc'.
- Add test case.

Minor correction of test case

src/SWDRAW/SWDRAW_ShapeUpgrade.cxx
tests/bugs/heal/bug28471 [new file with mode: 0644]

index 4735f8f..9dbbb7e 100644 (file)
@@ -1259,7 +1259,7 @@ static Standard_Integer removeloc (Draw_Interpretor& di,
                                    const char** argv)
 {
   if (argc<3) {
-    di << "bad number of arguments. Should be:  removeloc res shape\n";
+    di << "bad number of arguments. Should be:  removeloc res shape [remove_level(see ShapeEnum)]\n";
     return 1;
   }
   
@@ -1267,6 +1267,8 @@ static Standard_Integer removeloc (Draw_Interpretor& di,
   if(aShape.IsNull())
     return 1;
   ShapeUpgrade_RemoveLocations aRemLoc;
+  if (argc > 3)
+    aRemLoc.SetRemoveLevel((TopAbs_ShapeEnum)Draw::Atoi(argv[3]));
   aRemLoc.Remove(aShape);
   TopoDS_Shape aNewShape = aRemLoc.GetResult();
   
@@ -1376,7 +1378,7 @@ static Standard_Integer copytranslate(Draw_Interpretor& di,
                                    const char** argv)
 {
   if (argc<6) {
-    di << "bad number of arguments. Should be:  removeloc res shape dx dyy dz\n";
+    di << "bad number of arguments. Should be:  copytranslate res shape dx dy dz\n";
     return 1;
   }
   TopoDS_Shape aShape = DBRep::Get(argv[2]);
@@ -1571,7 +1573,7 @@ Standard_Integer reshape(Draw_Interpretor& di,
   theCommands.Add ("RemoveIntWires","result minarea wholeshape [faces or wires] [moderemoveface ]",
                    __FILE__,removeinternalwires,g);
   
-  theCommands.Add ("removeloc","result shape",__FILE__,removeloc,g);
+  theCommands.Add ("removeloc","result shape [remove_level(see ShapeEnum)]",__FILE__,removeloc,g);
   
   theCommands.Add ("unifysamedom",
                    "unifysamedom result shape [-f] [-e] [+b] [-i] [-t val] [-a val]", __FILE__,unifysamedom,g);
diff --git a/tests/bugs/heal/bug28471 b/tests/bugs/heal/bug28471
new file mode 100644 (file)
index 0000000..9142511
--- /dev/null
@@ -0,0 +1,14 @@
+puts "======="
+puts "OCC28471"
+puts "======="
+puts ""
+##################################################
+# ShapeUpgrade_RemoveLocations breaks sharing of sub-shapes
+##################################################
+
+restore [locate_data_file bug28471_faces_share_vertex.brep] a
+
+set remove_level 0 ;# allow compound
+removeloc r a $remove_level
+
+checknbshapes r -ref [nbshapes a]