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" +}