0023377: Error in importing a rational spline IGES surface [Type 128, PROP3 = 0]...
authorsneeraj <Neeraj.Srinivasan@geometricglobal.com>
Fri, 31 Aug 2012 11:33:33 +0000 (15:33 +0400)
committersneeraj <Neeraj.Srinivasan@geometricglobal.com>
Fri, 31 Aug 2012 11:33:33 +0000 (15:33 +0400)
Fix to address Rational surface with non-unitary weights at last index
Add new test case folder with test case for bugs

src/IGESGeom/IGESGeom_BSplineSurface.cxx
tests/bugs/begin [new file with mode: 0755]
tests/bugs/end [new file with mode: 0755]
tests/bugs/grids.list [new file with mode: 0755]
tests/bugs/iges/CR23377 [new file with mode: 0755]
tests/bugs/iges/begin [new file with mode: 0755]
tests/bugs/parse.rules [new file with mode: 0755]

index 2c15155..62493c2 100755 (executable)
@@ -115,8 +115,13 @@ IGESGeom_BSplineSurface::IGESGeom_BSplineSurface ()    {  }
   if (flag) return isPolynomial;
   Standard_Integer i,j;
   Standard_Real w0 = theWeights->Value(0,0);
-  for ( j = 0; j < theIndexV; j ++)
-    for (i = 0; i < theIndexU; i ++)
+  /*CR23377
+  * Following fix is needed to address Rational surface with non-unitary weights at last index
+  * Limit for indices are changed from theIndexV-->theIndexV+1 (=NbPolesV())
+  *                                    theIndexU--> theIndexU+1 (=NbPolesU())
+  */
+  for ( j = 0; j < (theIndexV+1); j ++)
+    for (i = 0; i < (theIndexU+1); i ++)
       if (Abs(theWeights->Value(i,j) - w0) > 1.e-10) return Standard_False;
   return Standard_True;
 }
diff --git a/tests/bugs/begin b/tests/bugs/begin
new file mode 100755 (executable)
index 0000000..f776798
--- /dev/null
@@ -0,0 +1,30 @@
+# File : begin
+if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
+    pload TOPTEST
+    pload VISUALIZATION
+#    set env(CSF_DrawPluginQADefaults) $env(CASROOT)/src/DrawResources/.
+#    pload QAcommands
+#    pload -DrawPluginQA QAcommands
+}
+
+# to prevent loops limit to 16 minutes
+cpulimit 1000
+
+#set script_dir [file dirname [info script]]/script
+# if { [info exist WorkDirectory] == 0 } {
+#    set WorkDirectory "/tmp"
+#    if { [array get env TEMP] != "" } {
+#      set WorkDirectory "$env(TEMP)"
+#      }
+#    }
+
+if { [info exists imagedir] == 0 } {
+   set imagedir .
+}
+if { [info exists test_image] == 0 } {
+   set test_image photo
+}
+
+
+
+
diff --git a/tests/bugs/end b/tests/bugs/end
new file mode 100755 (executable)
index 0000000..82228b1
--- /dev/null
@@ -0,0 +1,22 @@
+if { [isdraw result] } {
+    if { [info exists 2dviewer] } {
+       clear
+       smallview
+       donly result
+       fit
+       xwd $imagedir/${test_image}.gif
+    }
+    if { [info exists 3dviewer] } {
+       vclear
+       vdisplay result
+       vsetdispmode 1
+       vfit
+       vdump $imagedir/${test_image}.gif
+    }
+} else {
+   puts "Error : The command can not be build."
+}
+
+# to end a test script
+puts "TEST COMPLETED"
+
diff --git a/tests/bugs/grids.list b/tests/bugs/grids.list
new file mode 100755 (executable)
index 0000000..bd9ecb3
--- /dev/null
@@ -0,0 +1,2 @@
+001 iges
+
diff --git a/tests/bugs/iges/CR23377 b/tests/bugs/iges/CR23377
new file mode 100755 (executable)
index 0000000..9bddc76
--- /dev/null
@@ -0,0 +1,17 @@
+# Original bug : 23377
+# Date : 12 Aug 2012
+
+igesbrep [locate_data_file OCC23377-Input.igs] result *
+regexp {Number of Rational BSpline surfaces +([-0-9.+eE]+)} [expshape result 1 1] full nb
+puts "Number of Rational BSpline surfaces is $nb"
+set 2dviewer 1
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/bugs/iges/begin b/tests/bugs/iges/begin
new file mode 100755 (executable)
index 0000000..437191e
--- /dev/null
@@ -0,0 +1,9 @@
+pload XDE
+pload AISV
+
+
+
+
+
+
+
diff --git a/tests/bugs/parse.rules b/tests/bugs/parse.rules
new file mode 100755 (executable)
index 0000000..327154c
--- /dev/null
@@ -0,0 +1,5 @@
+error /\bError\b/
+error /\bFaulty\b/
+
+
+