From 4aa09e317f7be81a906439ff4bc08a4b4e8043ba Mon Sep 17 00:00:00 2001 From: isn Date: Mon, 11 Jul 2016 12:52:59 +0300 Subject: [PATCH] 0027264: Weird difference between two BRepTools::Write() overloads Assume that the brep file contains DBRep_DrawableShape variable if the file header is absent test cases --- src/Draw/Draw_VariableCommands.cxx | 18 ++++++++++++++++-- tests/bugs/modalg_6/bug27264_1 | 14 ++++++++++++++ tests/bugs/modalg_6/bug27264_2 | 14 ++++++++++++++ tests/bugs/modalg_6/bug27264_3 | 15 +++++++++++++++ tests/bugs/modalg_6/bug27264_4 | 15 +++++++++++++++ tests/bugs/modalg_6/bug27264_5 | 15 +++++++++++++++ tests/bugs/modalg_6/bug27264_6 | 15 +++++++++++++++ 7 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/modalg_6/bug27264_1 create mode 100644 tests/bugs/modalg_6/bug27264_2 create mode 100644 tests/bugs/modalg_6/bug27264_3 create mode 100644 tests/bugs/modalg_6/bug27264_4 create mode 100644 tests/bugs/modalg_6/bug27264_5 create mode 100644 tests/bugs/modalg_6/bug27264_6 diff --git a/src/Draw/Draw_VariableCommands.cxx b/src/Draw/Draw_VariableCommands.cxx index 76fea732fc..59e01f7394 100644 --- a/src/Draw/Draw_VariableCommands.cxx +++ b/src/Draw/Draw_VariableCommands.cxx @@ -227,15 +227,29 @@ static Standard_Integer restore(Draw_Interpretor& di, Standard_Integer n, const progress->Show(); Draw_SaveAndRestore* tool = Draw_First; + Draw_SaveAndRestore* aDBRepTool = NULL; while (tool) { - if (!strcmp(typ,tool->Name())) break; + const char* toolName = tool->Name(); + if (!strcmp(typ,toolName)) break; + if (!strcmp("DBRep_DrawableShape",toolName)) + aDBRepTool = tool; Draw::SetProgressBar(progress); tool = tool->Next(); } - if (tool) { + + if (!tool) + { + //assume that this file stores a DBRep_DrawableShape variable + tool = aDBRepTool; + in.seekg(0, ios::beg); + } + + if (tool) + { Handle(Draw_Drawable3D) D = tool->Restore(in); Draw::Set(name,D,tool->Disp() && autodisp); } + else { di << "Cannot restore a " << typ; return 1; diff --git a/tests/bugs/modalg_6/bug27264_1 b/tests/bugs/modalg_6/bug27264_1 new file mode 100644 index 0000000000..a251b0a32e --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_1 @@ -0,0 +1,14 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_1.brep] a + +checknbshapes a -vertex 8 -edge 12 -face 6 +checkprops a -s 6 +checkshape a + diff --git a/tests/bugs/modalg_6/bug27264_2 b/tests/bugs/modalg_6/bug27264_2 new file mode 100644 index 0000000000..fa7005ebe0 --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_2 @@ -0,0 +1,14 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_2.brep] a + +checknbshapes a -vertex 2 -edge 3 -face 1 +checkprops a -s 1256.64 +checkshape a + diff --git a/tests/bugs/modalg_6/bug27264_3 b/tests/bugs/modalg_6/bug27264_3 new file mode 100644 index 0000000000..e54e0ebc42 --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_3 @@ -0,0 +1,15 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_3.brep] a + +set info [nbshapes a] + +if {[string compare $info ""] != 0} { + puts "ERROR: null shape is expected here" +} diff --git a/tests/bugs/modalg_6/bug27264_4 b/tests/bugs/modalg_6/bug27264_4 new file mode 100644 index 0000000000..91e468713a --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_4 @@ -0,0 +1,15 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_4.brep] a + +set info [nbshapes a] + +if {[string compare $info ""] != 0} { + puts "ERROR: null shape is expected here" +} diff --git a/tests/bugs/modalg_6/bug27264_5 b/tests/bugs/modalg_6/bug27264_5 new file mode 100644 index 0000000000..e17b99bddc --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_5 @@ -0,0 +1,15 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_5.brep] a + +set info [nbshapes a] + +if {[string compare $info ""] != 0} { + puts "ERROR: null shape is expected here" +} diff --git a/tests/bugs/modalg_6/bug27264_6 b/tests/bugs/modalg_6/bug27264_6 new file mode 100644 index 0000000000..1a755b23c9 --- /dev/null +++ b/tests/bugs/modalg_6/bug27264_6 @@ -0,0 +1,15 @@ +puts "============" +puts "OCC27264" +puts "============" +puts "" +############################### +## Weird difference between two BRepTools::Write() overloads +############################### + +restore [locate_data_file bug27264_6.brep] a + +set info [nbshapes a] + +if {[string compare $info ""] != 0} { + puts "ERROR: null shape is expected here" +}