0027264: Weird difference between two BRepTools::Write() overloads
authorisn <isn@opencascade.com>
Mon, 11 Jul 2016 09:52:59 +0000 (12:52 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 21 Jul 2016 08:05:39 +0000 (11:05 +0300)
Assume that the brep file contains DBRep_DrawableShape variable if the file header is absent

test cases

src/Draw/Draw_VariableCommands.cxx
tests/bugs/modalg_6/bug27264_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug27264_2 [new file with mode: 0644]
tests/bugs/modalg_6/bug27264_3 [new file with mode: 0644]
tests/bugs/modalg_6/bug27264_4 [new file with mode: 0644]
tests/bugs/modalg_6/bug27264_5 [new file with mode: 0644]
tests/bugs/modalg_6/bug27264_6 [new file with mode: 0644]

index 76fea732fcf5a8b2c369df6420447e77bdd176ec..59e01f7394762119f39f48d60336a2732e5bf5e8 100644 (file)
@@ -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 (file)
index 0000000..a251b0a
--- /dev/null
@@ -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 (file)
index 0000000..fa7005e
--- /dev/null
@@ -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 (file)
index 0000000..e54e0eb
--- /dev/null
@@ -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 (file)
index 0000000..91e4687
--- /dev/null
@@ -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 (file)
index 0000000..e17b99b
--- /dev/null
@@ -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 (file)
index 0000000..1a755b2
--- /dev/null
@@ -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"
+}