]> OCCT Git - occt-copy.git/commitdiff
Modified STEP resource file in order to prevent producing of faces unsuitable for... CR27122
authoroan <oan@opencascade.com>
Fri, 29 Jan 2016 14:22:52 +0000 (17:22 +0300)
committeroan <oan@opencascade.com>
Fri, 29 Jan 2016 14:22:52 +0000 (17:22 +0300)
Test case added.
Modified xdistc2dc2dss command in order to catch output in draw interpretor.

src/GeometryTest/GeometryTest_TestProjCommands.cxx
src/XSTEPResource/STEP
tests/bugs/step/bug27122 [new file with mode: 0644]

index 2fbd7713d43fc94a9cfac9e8a9ed1be6b24bd6cc..37b686725961853b24360c06d4761538de42fb55 100644 (file)
@@ -112,7 +112,7 @@ static Standard_Integer xdistcc(Draw_Interpretor& , Standard_Integer n, const ch
 //function : xdistc2dc2dss
 //purpose  : 
 //=======================================================================
-static Standard_Integer xdistc2dc2dss(Draw_Interpretor& , Standard_Integer n, const char** a)
+static Standard_Integer xdistc2dc2dss(Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
   if (n < 7)
   {
@@ -132,28 +132,28 @@ static Standard_Integer xdistc2dc2dss(Draw_Interpretor& , Standard_Integer n, co
   aC2d1=DrawTrSurf::GetCurve2d(a[1]);
   if (aC2d1.IsNull())
   {
-    cout<<a[1]<<" is null 2dcurve"<<endl;
+    di<<a[1]<<" is null 2dcurve\n";
     return 0;
   }
 
   aC2d2=DrawTrSurf::GetCurve2d(a[2]);
   if (aC2d2.IsNull())
   {
-    cout<<a[2]<<" is null 2dcurve"<<endl;
+    di<<a[2]<<" is null 2dcurve\n";
     return 0;
   }
 
   aS1=DrawTrSurf::GetSurface(a[3]);
   if (aS1.IsNull())
   {
-    cout<<a[3]<<" is null surface"<<endl;
+    di<<a[3]<<" is null surface\n";
     return 0;
   }
 
   aS2=DrawTrSurf::GetSurface(a[4]);
   if (aS2.IsNull())
   {
-    cout<<a[4]<<" is null surface"<<endl;
+    di<<a[4]<<" is null surface\n";
     return 0;
   }
 
@@ -192,14 +192,16 @@ static Standard_Integer xdistc2dc2dss(Draw_Interpretor& , Standard_Integer n, co
       aMaxDist = aD;
     }
 
-    printf(" T=%lg\tD=%lg\n", aT, aD);
+    char aMsg[256];
+    sprintf(aMsg," T=%lg\tD=%lg\n", aT, aD);
+    di << aMsg;
 
     aMr=new Draw_Marker3D(aP1, Draw_Plus, aColor, iSize);
     dout << aMr;
   }
 
-  cout << "Max distance = "  << aMaxDist << endl;
-  cout << "Param = " << aMaxParam << endl;
+  di << "Max distance = "  << aMaxDist << "\n";
+  di << "Param = " << aMaxParam << "\n";
 
   return 0;
 }
index 15858bbebf5c888d9c6a378dfed0a31752e53ef9..33885a8c4a8da0a71ea67cc1ecd602b2259e71d8 100755 (executable)
@@ -10,7 +10,7 @@ ToSTEP.exec.op : SplitCommonVertex,DirectFaces
 
 FromSTEP.exec.op : FixShape
 
-FromSTEP.FixShape.Tolerance3d                  : &Runtime.Tolerance
+FromSTEP.FixShape.Tolerance3d                  : 1.e-7
 FromSTEP.FixShape.MaxTolerance3d               : &Runtime.MaxTolerance
 FromSTEP.FixShape.MinTolerance3d               : 1.e-7
 FromSTEP.FixShape.FixFreeShellMode             : -1
diff --git a/tests/bugs/step/bug27122 b/tests/bugs/step/bug27122
new file mode 100644 (file)
index 0000000..8a39234
--- /dev/null
@@ -0,0 +1,52 @@
+puts "================"
+puts "OCC27122"
+puts "================"
+puts ""
+#####################################################################
+# STEP import regression: invalid shapes are produced during model translation due to huge face tolerance
+#####################################################################
+
+pload XDE
+
+# procedure to check distance between pcurves
+proc checkdist {c2d1 c2d2 s threshold} {
+    
+  set prop [uplevel xdistc2dc2dss $c2d1 $c2d2 $s $s 0 1 25]
+
+  # get distance value
+  if { ! [regexp {Max distance\s*=\s*([0-9.e+-]+)} $prop res dist] } {
+    puts "Error: cannot get distance value"
+    return
+  }
+
+  # compare with expected value
+  if { $dist < $threshold } {
+    puts "Error: coinciding curves (distance = $dist)"
+  }
+}
+
+#procedure to check thin faces
+proc checkface {face} {
+  uplevel mksurface s $face
+  uplevel explode $face e
+  uplevel mk2dcurve c1 ${face}_1 $face
+  uplevel mk2dcurve c2 ${face}_2 $face
+  
+  uplevel reverse c2
+  uplevel checkdist c1 c2 s 0.03
+  
+  uplevel incmesh $face 0.01
+  set log [uplevel tricheck $face]
+  if {[llength $log] != 0} {
+    puts "Error: failed to mesh face $face"
+  }
+}
+
+stepread [locate_data_file 280696.stp] a *
+renamevar a_1 result
+
+explode result f
+checkface result_3
+checkface result_8
+
+