From 15b2583e6915e48795bf8d9bafede27cc10dea79 Mon Sep 17 00:00:00 2001 From: msv Date: Fri, 17 Feb 2017 18:59:49 +0300 Subject: [PATCH] 0028471: ShapeUpgrade_RemoveLocations breaks sharing of sub-shapes - Add option 'remove_level' to the command 'removeloc'. - Add test case. Minor correction of test case --- src/SWDRAW/SWDRAW_ShapeUpgrade.cxx | 8 +++++--- tests/bugs/heal/bug28471 | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/heal/bug28471 diff --git a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx index 4735f8fc16..9dbbb7ea9a 100644 --- a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx +++ b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx @@ -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 index 0000000000..914251111f --- /dev/null +++ b/tests/bugs/heal/bug28471 @@ -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]