Added new parameter to bopcheck command that defines which interferences to check:
bopcheck shape [level of check: 0 - 5]
Examples:
1. bopcheck shape 1
#The level of check is set to V/E, i.e. intersections #E/E, V/F, E/F, F/F will not be checked.
2. bopcheck shape 4
#The level of check is set to E/F, i.e. intersection F/F is disabled.
3. bopcheck shape 5
#All intersections will be checked. It is the same as bopcheck shape.
Added test case bugs/modalg_5/bug24029
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;
#include <BOPDS_DS.hxx>
#include <BOPDS_IteratorSI.hxx>
+#include <BOPDS_PIteratorSI.hxx>
#include <BOPInt_Context.hxx>
//=======================================================================
//=======================================================================
BOPAlgo_CheckerSI::BOPAlgo_CheckerSI()
:
- BOPAlgo_PaveFiller()
+ BOPAlgo_PaveFiller(),
+ myLevelOfCheck(5)
{
}
//=======================================================================
{
}
//=======================================================================
+//function : SetLevelOfCheck
+//purpose :
+//=======================================================================
+ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
+{
+ if (theLevel >= 0 && theLevel <= 5) {
+ myLevelOfCheck = theLevel;
+ }
+}
+//=======================================================================
//function : Init
//purpose :
//=======================================================================
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;
--
pointer PDS to DS from BOPDS;
pointer PIterator to Iterator from BOPDS;
+ pointer PIteratorSI to IteratorSI from BOPDS;
--
-- primitives
--
---
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 <theLevel>.
+ -- 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;
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()) {
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);
//-----------------------------------------------------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();
+ }
+}
//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;
//
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;
// 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);
}
{
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;
}
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();
//
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;
}
}
//
- di << type[aTypeInt];
+ di << type[aTypeInt] << ":";
//
TCollection_AsciiString aBaseName("x");
TCollection_AsciiString anumbername(ind);
--- /dev/null
+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"
+}
+