mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0025697: Regression : Section obtained after command "bsection" in Test Harness is incorrect.
Interface of bopcurves DDRAW-command were extended. Now it is possible to obtain a) only 3D-curves; b) 3D-curves and 2D-curves on one of surfaces intersected (surface can be selected); c) 3D-curves and 2D-curves on every surface intersected. Use "help bopcurves" to see detail information. Added test cases bugs/modalg_5/bug25697_1 bug25697_2 Small changes in test case bugs/modalg_5/bug25697_2
This commit is contained in:
parent
1b7ae95146
commit
99c5f9f045
@ -115,7 +115,8 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
|
|||||||
theCommands.Add("bsection", "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
|
theCommands.Add("bsection", "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
|
||||||
__FILE__, bsection, g);
|
__FILE__, bsection, g);
|
||||||
//
|
//
|
||||||
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, g);
|
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2]",
|
||||||
|
__FILE__, bopcurves, g);
|
||||||
theCommands.Add("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
|
theCommands.Add("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
|
||||||
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
|
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
|
||||||
__FILE__, mkvolume , g);
|
__FILE__, mkvolume , g);
|
||||||
@ -612,19 +613,19 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
|||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<3) {
|
if (n<3) {
|
||||||
di << " use bopcurves F1 F2 [-2d]\n";
|
di << " use bopcurves F1 F2 [-2d/-2d1/-2d2]\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
TopoDS_Shape S1 = DBRep::Get(a[1]);
|
TopoDS_Shape S1 = DBRep::Get(a[1]);
|
||||||
TopoDS_Shape S2 = DBRep::Get(a[2]);
|
TopoDS_Shape S2 = DBRep::Get(a[2]);
|
||||||
TopAbs_ShapeEnum aType;
|
TopAbs_ShapeEnum aType;
|
||||||
|
//
|
||||||
if (S1.IsNull() || S2.IsNull()) {
|
if (S1.IsNull() || S2.IsNull()) {
|
||||||
di << " Null shapes is not allowed \n";
|
di << " Null shapes is not allowed \n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
aType=S1.ShapeType();
|
aType=S1.ShapeType();
|
||||||
if (aType != TopAbs_FACE) {
|
if (aType != TopAbs_FACE) {
|
||||||
di << " Type mismatch F1\n";
|
di << " Type mismatch F1\n";
|
||||||
@ -635,49 +636,52 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
|||||||
di << " Type mismatch F2\n";
|
di << " Type mismatch F2\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
|
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
|
||||||
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
|
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
|
||||||
|
//
|
||||||
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1,
|
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
|
||||||
aToApproxC2dOnS2, anIsDone, bMake2dCurves;
|
|
||||||
Standard_Integer i, aNbCurves;
|
Standard_Integer i, aNbCurves;
|
||||||
Standard_Real anAppTol, aTolR;
|
Standard_Real anAppTol, aTolR;
|
||||||
TCollection_AsciiString aNm("c_");
|
TCollection_AsciiString aNm("c_");
|
||||||
|
//
|
||||||
bMake2dCurves = Standard_False;
|
anAppTol = 0.0000001;
|
||||||
|
aToApproxC3d = Standard_True;
|
||||||
|
aToApproxC2dOnS1 = Standard_False;
|
||||||
|
aToApproxC2dOnS2 = Standard_False;
|
||||||
|
//
|
||||||
if (n > 3) {
|
if (n > 3) {
|
||||||
if (!strcasecmp(a[3],"-2d")) {
|
if (!strcasecmp(a[3],"-2d")) {
|
||||||
bMake2dCurves = Standard_True;
|
aToApproxC2dOnS1 = Standard_True;
|
||||||
} else {
|
aToApproxC2dOnS2 = Standard_True;
|
||||||
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d \n";
|
}
|
||||||
|
else if (!strcasecmp(a[3],"-2d1")) {
|
||||||
|
aToApproxC2dOnS1 = Standard_True;
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(a[3],"-2d2")) {
|
||||||
|
aToApproxC2dOnS2 = Standard_True;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d/-2d1/-2d2 \n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
aToApproxC3d = Standard_True;
|
|
||||||
aToApproxC2dOnS1 = bMake2dCurves;
|
|
||||||
aToApproxC2dOnS2 = bMake2dCurves;
|
|
||||||
anAppTol=0.0000001;
|
|
||||||
|
|
||||||
|
|
||||||
IntTools_FaceFace aFF;
|
IntTools_FaceFace aFF;
|
||||||
|
//
|
||||||
aFF.SetParameters (aToApproxC3d,
|
aFF.SetParameters (aToApproxC3d,
|
||||||
aToApproxC2dOnS1,
|
aToApproxC2dOnS1,
|
||||||
aToApproxC2dOnS2,
|
aToApproxC2dOnS2,
|
||||||
anAppTol);
|
anAppTol);
|
||||||
|
//
|
||||||
aFF.Perform (aF1, aF2);
|
aFF.Perform (aF1, aF2);
|
||||||
|
//
|
||||||
anIsDone=aFF.IsDone();
|
anIsDone=aFF.IsDone();
|
||||||
if (!anIsDone) {
|
if (!anIsDone) {
|
||||||
di << " anIsDone=" << (Standard_Integer) anIsDone << "\n";
|
di << " anIsDone=" << (Standard_Integer) anIsDone << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
aFF.PrepareLines3D(Standard_False);
|
aFF.PrepareLines3D(Standard_False);
|
||||||
const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
|
const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
|
||||||
|
|
||||||
@ -690,7 +694,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
|||||||
di << " has no 3d curve\n";
|
di << " has no 3d curve\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
di << aNbCurves << " curve(s) found.\n";
|
di << aNbCurves << " curve(s) found.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,51 +717,38 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
|||||||
DrawTrSurf::Set(nameC, aC3D);
|
DrawTrSurf::Set(nameC, aC3D);
|
||||||
di << nameC << " ";
|
di << nameC << " ";
|
||||||
//
|
//
|
||||||
if (bMake2dCurves) {
|
Handle(Geom2d_Curve) aPC1 = anIC.FirstCurve2d();
|
||||||
Handle(Geom2d_Curve) aPC1 = anIC.FirstCurve2d();
|
Handle(Geom2d_Curve) aPC2 = anIC.SecondCurve2d();
|
||||||
Handle(Geom2d_Curve) aPC2 = anIC.SecondCurve2d();
|
//
|
||||||
|
if (!aPC1.IsNull() || !aPC2.IsNull()) {
|
||||||
|
di << "(";
|
||||||
//
|
//
|
||||||
if (aPC1.IsNull() && aPC2.IsNull()) {
|
if (!aPC1.IsNull()) {
|
||||||
di << " \n has Null 2d curves# " << i << "\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aPC1.IsNull()) {
|
|
||||||
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
|
|
||||||
pc2Nx = pc2N + anIndx;
|
|
||||||
Standard_CString nameC2d2 = pc2Nx.ToCString();
|
|
||||||
//
|
|
||||||
DrawTrSurf::Set(nameC2d2, aPC2);
|
|
||||||
di << "(" << nameC2d2 << ") ";
|
|
||||||
di << " \n Null first 2d curve of the curve #" << i << "\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
|
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
|
||||||
pc1Nx = pc1N + anIndx;
|
pc1Nx = pc1N + anIndx;
|
||||||
Standard_CString nameC2d1 = pc1Nx.ToCString();
|
Standard_CString nameC2d1 = pc1Nx.ToCString();
|
||||||
//
|
//
|
||||||
DrawTrSurf::Set(nameC2d1, aPC1);
|
DrawTrSurf::Set(nameC2d1, aPC1);
|
||||||
di << "(" << nameC2d1;
|
di << nameC2d1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (aPC2.IsNull()) {
|
if (!aPC2.IsNull()) {
|
||||||
di << ") \n Null second 2d curve of the curve #" << i << "\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
|
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
|
||||||
pc2Nx = pc2N + anIndx;
|
pc2Nx = pc2N + anIndx;
|
||||||
Standard_CString nameC2d2 = pc2Nx.ToCString();
|
Standard_CString nameC2d2 = pc2Nx.ToCString();
|
||||||
//
|
//
|
||||||
DrawTrSurf::Set(nameC2d2, aPC2);
|
DrawTrSurf::Set(nameC2d2, aPC2);
|
||||||
di << ", " << nameC2d2 << ") ";
|
//
|
||||||
|
if (!aPC1.IsNull()) {
|
||||||
|
di << ", ";
|
||||||
|
}
|
||||||
|
di << nameC2d2;
|
||||||
}
|
}
|
||||||
|
di << ") ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
di << "\n";
|
di << "\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
20
tests/bugs/modalg_5/bug25697_1
Normal file
20
tests/bugs/modalg_5/bug25697_1
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC25697"
|
||||||
|
puts "==========="
|
||||||
|
puts ""
|
||||||
|
##########################################################################################
|
||||||
|
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25697_shell_for_seam.brep] s1
|
||||||
|
restore [locate_data_file bug25697_prism.brep] p1
|
||||||
|
bsection result s1 p1 -n2d2
|
||||||
|
|
||||||
|
regexp {nb alone Vertices : +([-0-9.+eE]+)} [checksection result] full nb_alone_Vertices
|
||||||
|
if { ${nb_alone_Vertices} == 2 } {
|
||||||
|
puts "OK: Good result done by Boolean Operation algorithm"
|
||||||
|
} else {
|
||||||
|
puts "Error: Wrong result done by Boolean Operation algorithm"
|
||||||
|
}
|
||||||
|
|
||||||
|
set length 107.503
|
63
tests/bugs/modalg_5/bug25697_2
Normal file
63
tests/bugs/modalg_5/bug25697_2
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
puts "=========="
|
||||||
|
puts "OCC25697"
|
||||||
|
puts "=========="
|
||||||
|
puts ""
|
||||||
|
########################################################################################
|
||||||
|
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
|
||||||
|
########################################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25697_shell_for_seam.brep] b1
|
||||||
|
restore [locate_data_file bug25697_prism.brep] b2
|
||||||
|
explode b1 f
|
||||||
|
copy b1_1 b1
|
||||||
|
explode b2 f
|
||||||
|
copy b2_1 b2
|
||||||
|
|
||||||
|
#################################
|
||||||
|
set log [bopcurves b1 b2 -2d1]
|
||||||
|
#################################
|
||||||
|
|
||||||
|
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
|
||||||
|
|
||||||
|
set MaxTol 1.e-7
|
||||||
|
set GoodNbCurv 3
|
||||||
|
|
||||||
|
if { ${Toler} > ${MaxTol} } {
|
||||||
|
puts "Error: Tolerance is too big!"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { ${NbCurv} != ${GoodNbCurv} } {
|
||||||
|
puts "Error: Curve Number is bad!"
|
||||||
|
}
|
||||||
|
|
||||||
|
#---------------
|
||||||
|
mksurface s1 b1
|
||||||
|
mksurface s2 b2
|
||||||
|
|
||||||
|
for {set i 1} {$i <= ${NbCurv}} {incr i} {
|
||||||
|
bounds c_$i u1 u2
|
||||||
|
dump u1 u2
|
||||||
|
dlog reset
|
||||||
|
dlog on
|
||||||
|
xdistcs c_$i s1 u1 u2 10
|
||||||
|
set Log2 [dlog get]
|
||||||
|
set List2 [split ${Log2} {TD= \t\n}]
|
||||||
|
set Tolerance 1.0e-7
|
||||||
|
set Limit_Tol 1.0e-7
|
||||||
|
set D_good 0.
|
||||||
|
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
|
||||||
|
|
||||||
|
dlog reset
|
||||||
|
dlog on
|
||||||
|
xdistcs c_$i s2 u1 u2 10
|
||||||
|
set Log2 [dlog get]
|
||||||
|
set List2 [split ${Log2} {TD= \t\n}]
|
||||||
|
set Tolerance 1.0e-7
|
||||||
|
set Limit_Tol 1.0e-7
|
||||||
|
set D_good 0.
|
||||||
|
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
Loading…
x
Reference in New Issue
Block a user