diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl index 7cab5935cc..ca900312ea 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl @@ -31,5 +31,19 @@ is Init (me:out) is redefined protected; + + SetLevelOfCheck(me:out; + theLevel: Integer from Standard); + ---Purpose: Sets the level of checking shape on self-interference. + -- It defines which interferferences will be checked: + -- 0 - only V/V; + -- 1 - V/V and V/E; + -- 2 - V/V, V/E and E/E; + -- 3 - V/V, V/E, E/E and V/F; + -- 4 - V/V, V/E, E/E, V/F and E/F; + -- 5 - all interferences, default value. + +fields + myLevelOfCheck: Integer from Standard is protected; end CheckerSI; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index 6a8da68098..8fc457e4c5 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -23,6 +23,7 @@ #include #include +#include #include //======================================================================= @@ -31,7 +32,8 @@ //======================================================================= BOPAlgo_CheckerSI::BOPAlgo_CheckerSI() : - BOPAlgo_PaveFiller() + BOPAlgo_PaveFiller(), + myLevelOfCheck(5) { } //======================================================================= @@ -42,6 +44,16 @@ { } //======================================================================= +//function : SetLevelOfCheck +//purpose : +//======================================================================= + void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) +{ + if (theLevel >= 0 && theLevel <= 5) { + myLevelOfCheck = theLevel; + } +} +//======================================================================= //function : Init //purpose : //======================================================================= @@ -62,9 +74,12 @@ myDS->Init(); // // 2.myIterator - myIterator=new BOPDS_IteratorSI(myAllocator); - myIterator->SetDS(myDS); - myIterator->Prepare(); + BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator); + theIterSI->SetDS(myDS); + theIterSI->Prepare(); + theIterSI->UpdateByLevelOfCheck(myLevelOfCheck); + // + myIterator=theIterSI; // // 3 myContext myContext=new BOPInt_Context; diff --git a/src/BOPDS/BOPDS.cdl b/src/BOPDS/BOPDS.cdl index 01ddcc6905..e9e8e686ac 100644 --- a/src/BOPDS/BOPDS.cdl +++ b/src/BOPDS/BOPDS.cdl @@ -62,6 +62,7 @@ is -- pointer PDS to DS from BOPDS; pointer PIterator to Iterator from BOPDS; + pointer PIteratorSI to IteratorSI from BOPDS; -- -- primitives -- diff --git a/src/BOPDS/BOPDS_IteratorSI.cdl b/src/BOPDS/BOPDS_IteratorSI.cdl index 04751b13b3..c4d233e60d 100644 --- a/src/BOPDS/BOPDS_IteratorSI.cdl +++ b/src/BOPDS/BOPDS_IteratorSI.cdl @@ -50,5 +50,17 @@ is --- Intersect(me:out) is redefined protected; + + UpdateByLevelOfCheck(me:out; + theLevel: Integer from Standard); + ---Purpose: Updates the lists of possible intersections + -- according to the value of . + -- It defines which interferferences will be checked: + -- 0 - only V/V; + -- 1 - V/V and V/E; + -- 2 - V/V, V/E and E/E; + -- 3 - V/V, V/E, E/E and V/F; + -- 4 - V/V, V/E, E/E, V/F and E/F; + -- other - all interferences. end IteratorSI; diff --git a/src/BOPDS/BOPDS_IteratorSI.cxx b/src/BOPDS/BOPDS_IteratorSI.cxx index 8886c090c2..6310364eee 100644 --- a/src/BOPDS/BOPDS_IteratorSI.cxx +++ b/src/BOPDS/BOPDS_IteratorSI.cxx @@ -107,7 +107,6 @@ const TopoDS_Shape& aSi=aSI.Shape(); aTi=aSI.ShapeType(); if (aTi!=TopAbs_VERTEX) { - //-- const BOPCol_ListOfInteger& aLA=aSI.SubShapes(); aIt.Initialize(aLA); for (; aIt.More(); aIt.Next()) { @@ -116,14 +115,12 @@ aPKXB.SetIds(i, iX); aMPA.Add(aPKXB); } - //--t - } - else { - aPKXB.Clear(); - aPKXB.SetIds(i, i); - aMPA.Add(aPKXB); } // + aPKXB.Clear(); + aPKXB.SetIds(i, i); + aMPA.Add(aPKXB); + // const Bnd_Box& aBoxEx=aSI.Box(); // aMSI.Bind(aSi, i); @@ -202,3 +199,15 @@ //-----------------------------------------------------scope_1 t } +//======================================================================= +// function: UpdateByLevelOfCheck +// purpose: +//======================================================================= + void BOPDS_IteratorSI::UpdateByLevelOfCheck(const Standard_Integer theLevel) +{ + Standard_Integer i; + // + for (i=theLevel+1; i<6; ++i) { + myLists(i).Clear(); + } +} diff --git a/src/BOPDS/BOPDS_Tools.lxx b/src/BOPDS/BOPDS_Tools.lxx index 30657d22ba..6c21af6581 100644 --- a/src/BOPDS/BOPDS_Tools.lxx +++ b/src/BOPDS/BOPDS_Tools.lxx @@ -28,7 +28,7 @@ //purpose : //======================================================================= inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) + const TopAbs_ShapeEnum aType2) { Standard_Integer iRet, iT1, iT2, iX; // @@ -39,25 +39,25 @@ iX=iT2*10+iT1; switch (iX) { case 77: - iRet=5; // VV + iRet=0; // VV break; case 76: case 67: - iRet=4; // VE + iRet=1; // VE + break; + case 66: + iRet=2; // EE break; case 74: case 47: - iRet=2; // VF - break; - case 66: - iRet=3; // EE + iRet=3; // VF break; case 64: case 46: - iRet=1; // EF + iRet=4; // EF break; case 44: - iRet=0; // FF + iRet=5; // FF break; default: break; diff --git a/src/BOPTest/BOPTest_CheckCommands.cxx b/src/BOPTest/BOPTest_CheckCommands.cxx index 3bd59f7e68..da90f6d0e1 100644 --- a/src/BOPTest/BOPTest_CheckCommands.cxx +++ b/src/BOPTest/BOPTest_CheckCommands.cxx @@ -68,7 +68,7 @@ static // Chapter's name const char* g = "CCR commands"; // - theCommands.Add("bopcheck" , "Use >bopcheck Shape", __FILE__, bopcheck, g); + theCommands.Add("bopcheck" , "Use >bopcheck Shape [level of check: 0(V/V) - 5(all)]", __FILE__, bopcheck, g); theCommands.Add("bopargcheck" , "Use bopargcheck without parameters to get ", __FILE__, bopargcheck, g); } @@ -80,7 +80,14 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char { if (n<2) { - di << " Use >bopcheck Shape" << "\n"; + di << " Use >bopcheck Shape [level of check: 0 - 5" << "\n"; + di << " The level of check defines which interferferences will be checked:\n"; + di << " 0 - only V/V;\n"; + di << " 1 - V/V and V/E;\n"; + di << " 2 - V/V, V/E and E/E;\n"; + di << " 3 - V/V, V/E, E/E and V/F;\n"; + di << " 4 - V/V, V/E, E/E, V/F and E/F;\n"; + di << " 5 - all interferences, default value.\n"; return 1; } @@ -92,14 +99,29 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char TopoDS_Shape aS = BRepBuilderAPI_Copy(aS1).Shape(); // Standard_Integer iErr, aTypeInt, i, ind, j; - Standard_Integer nI1, nI2; + Standard_Integer nI1, nI2, theLevelOfCheck; Standard_Boolean bSelfInt, bFFInt; char buf[256]; + char type[6][4] = {"V/V", "V/E", "E/E","V/F", "E/F", "F/F"}; + + theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : 5; + if (theLevelOfCheck >= 0 && theLevelOfCheck < 5) { + di << "Info:\nThe level of check is set to " << type[theLevelOfCheck] + << ", i.e. intersection(s)\n"; + for (i=theLevelOfCheck+1; i<=5; ++i) { + di << type[i]; + if (i<5) { + di << ", "; + } + } + di << " will not be checked.\n\n"; + } BOPAlgo_CheckerSI aChecker; BOPCol_ListOfShape anArgs; anArgs.Append(aS); aChecker.SetArguments(anArgs); + aChecker.SetLevelOfCheck(theLevelOfCheck); // aChecker.Perform(); iErr = aChecker.ErrorStatus(); @@ -114,8 +136,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char // Standard_Integer aNb[6] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), aVFs.Extent(), aEFs.Extent(), aFFs.Extent()}; - char type[6][5] = {"V/V:", "V/E:", "E/E:","V/F:", "E/F:", "F/F:"}; - // bSelfInt = Standard_False; ind = 0; @@ -166,7 +186,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char } } // - di << type[aTypeInt]; + di << type[aTypeInt] << ":"; // TCollection_AsciiString aBaseName("x"); TCollection_AsciiString anumbername(ind); diff --git a/tests/bugs/modalg_5/bug24029 b/tests/bugs/modalg_5/bug24029 new file mode 100644 index 0000000000..0841d10551 --- /dev/null +++ b/tests/bugs/modalg_5/bug24029 @@ -0,0 +1,34 @@ +puts "============" +puts "OCC24029" +puts "============" +puts "" +############################################################################################ +# Add a flag to bopcheck command to provide possibility to disable Face/Face intersection +############################################################################################ + +box b1 10 10 10 +box b2 5 5 5 10 10 10 +compound b1 b2 c + +set info1 [bopcheck c] +set info2 [bopcheck c 4] +set info3 [bopcheck c 3] + +if { [regexp "x23" $info1] != 1 } { + puts "Error : bopcheck c works wrong" +} else { + puts "OK: bopcheck c works properly" +} + +if { [regexp "x11" $info2] != 1 || [regexp "F/F:x12," $info2] != 0 } { + puts "Error : bopcheck c 4 works wrong" +} else { + puts "OK: bopcheck c 4 works properly" +} + +if { [regexp "This shape seems to be OK" $info3] != 1 } { + puts "Error : bopcheck c 3 works wrong" +} else { + puts "OK: bopcheck c 3 works properly" +} +