1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0024029: Add a flag to bopcheck command to provide possibility to disable Face/Face intersection

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
This commit is contained in:
emv 2013-07-12 12:21:38 +04:00
parent 388fc344c9
commit c1fe53c64e
8 changed files with 131 additions and 26 deletions

View File

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

View File

@ -23,6 +23,7 @@
#include <BOPDS_DS.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPDS_PIteratorSI.hxx>
#include <BOPInt_Context.hxx>
//=======================================================================
@ -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;

View File

@ -62,6 +62,7 @@ is
--
pointer PDS to DS from BOPDS;
pointer PIterator to Iterator from BOPDS;
pointer PIteratorSI to IteratorSI from BOPDS;
--
-- primitives
--

View File

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

View File

@ -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();
}
}

View File

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

View File

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

View File

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