1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Modified STEP resource file in order to prevent producing of faces unsuitable for OCCT algorithms due to pcurves translated as lines instead of bsplines in case if tolerance specified in STEP file fully covers the target face.

Test case added.
Modified xdistc2dc2dss command in order to catch output in draw interpretor.
This commit is contained in:
oan
2016-02-03 12:28:37 +03:00
parent 31159de7da
commit f3d6d2bbf6
3 changed files with 64 additions and 10 deletions

View File

@@ -112,7 +112,7 @@ static Standard_Integer xdistcc(Draw_Interpretor& , Standard_Integer n, const ch
//function : xdistc2dc2dss //function : xdistc2dc2dss
//purpose : //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) if (n < 7)
{ {
@@ -132,28 +132,28 @@ static Standard_Integer xdistc2dc2dss(Draw_Interpretor& , Standard_Integer n, co
aC2d1=DrawTrSurf::GetCurve2d(a[1]); aC2d1=DrawTrSurf::GetCurve2d(a[1]);
if (aC2d1.IsNull()) if (aC2d1.IsNull())
{ {
cout<<a[1]<<" is null 2dcurve"<<endl; di<<a[1]<<" is null 2dcurve\n";
return 0; return 0;
} }
aC2d2=DrawTrSurf::GetCurve2d(a[2]); aC2d2=DrawTrSurf::GetCurve2d(a[2]);
if (aC2d2.IsNull()) if (aC2d2.IsNull())
{ {
cout<<a[2]<<" is null 2dcurve"<<endl; di<<a[2]<<" is null 2dcurve\n";
return 0; return 0;
} }
aS1=DrawTrSurf::GetSurface(a[3]); aS1=DrawTrSurf::GetSurface(a[3]);
if (aS1.IsNull()) if (aS1.IsNull())
{ {
cout<<a[3]<<" is null surface"<<endl; di<<a[3]<<" is null surface\n";
return 0; return 0;
} }
aS2=DrawTrSurf::GetSurface(a[4]); aS2=DrawTrSurf::GetSurface(a[4]);
if (aS2.IsNull()) if (aS2.IsNull())
{ {
cout<<a[4]<<" is null surface"<<endl; di<<a[4]<<" is null surface\n";
return 0; return 0;
} }
@@ -192,14 +192,16 @@ static Standard_Integer xdistc2dc2dss(Draw_Interpretor& , Standard_Integer n, co
aMaxDist = aD; 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); aMr=new Draw_Marker3D(aP1, Draw_Plus, aColor, iSize);
dout << aMr; dout << aMr;
} }
cout << "Max distance = " << aMaxDist << endl; di << "Max distance = " << aMaxDist << "\n";
cout << "Param = " << aMaxParam << endl; di << "Param = " << aMaxParam << "\n";
return 0; return 0;
} }

View File

@@ -8,8 +8,8 @@
ToSTEP.exec.op : SplitCommonVertex,DirectFaces ToSTEP.exec.op : SplitCommonVertex,DirectFaces
FromSTEP.exec.op : FixShape FromSTEP.exec.op : FixShape, FixFaceSize, FixShape
FromSTEP.FixFaceSize.Tolerance : &Runtime.Tolerance
FromSTEP.FixShape.Tolerance3d : &Runtime.Tolerance FromSTEP.FixShape.Tolerance3d : &Runtime.Tolerance
FromSTEP.FixShape.MaxTolerance3d : &Runtime.MaxTolerance FromSTEP.FixShape.MaxTolerance3d : &Runtime.MaxTolerance
FromSTEP.FixShape.MinTolerance3d : 1.e-7 FromSTEP.FixShape.MinTolerance3d : 1.e-7

52
tests/bugs/step/bug27122 Normal file
View File

@@ -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