1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024764: Alien subshapes occured in result of 'bopcheck' operation

class BOPAlgo_ArgumentAnalyzer
   - method:
void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
The new shapes has been excluded from the treatment

void BOPAlgo_CheckerSI::PostTreat()
The new shapes has been excluded from the treatment

Standard_Integer bopcheck
  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
The new shapes has been excluded from the treatment.
The interferences of the type */Solid has been included in the treatment.

Test case for issue CR24764
This commit is contained in:
pkv 2014-04-03 15:29:23 +04:00 committed by abv
parent d347054cd0
commit cfdd99315c
4 changed files with 220 additions and 98 deletions

View File

@ -338,54 +338,60 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
//
const Standard_Integer aNbTypeInt=10;
Standard_Integer aTypeInt, i, nI1, nI2;
Standard_Integer aNb[aNbTypeInt] = {
Standard_Integer aNbTypeInt, aTypeInt, i, nI1, nI2;
Standard_Integer aNb[] = {
aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(), aZZs.Extent()};
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(),
aZZs.Extent()
};
//
BOPDS_Interf* aInt=NULL;
//
aNbTypeInt=BOPDS_DS::NbInterfTypes();
for (aTypeInt = 0; aTypeInt < aNbTypeInt; ++aTypeInt) {
for (i = 0; i < aNb[aTypeInt]; ++i) {
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
aInt=NULL;
}
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
aInt=NULL;
}
//
aInt->Indices(nI1, nI2);
aInt->Indices(nI1, nI2);
if (nI1 == nI2) {
continue;
}
if (theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
continue;
}
//
if (aTypeInt == 4) {

View File

@ -125,7 +125,6 @@ void BOPAlgo_CheckerSI::Init()
//=======================================================================
void BOPAlgo_CheckerSI::Perform()
{
try {
OCC_CATCH_SIGNALS
//
@ -143,42 +142,46 @@ void BOPAlgo_CheckerSI::Perform()
}
//
BOPAlgo_PaveFiller::Perform();
if (myErrorStatus) {
return;
//
if (!myErrorStatus) {
PerformVZ();
}
//
PerformVZ();
if (myErrorStatus) {
return;
}
//
PerformEZ();
if (myErrorStatus) {
return;
if (!myErrorStatus) {
PerformEZ();
}
//
PerformFZ();
if (myErrorStatus) {
return;
if (!myErrorStatus) {
PerformFZ();
}
//
PerformZZ();
if (myErrorStatus) {
return;
if (!myErrorStatus) {
PerformZZ();
}
//
if (!myErrorStatus) {
PostTreat();
}
//
PostTreat();
if (myErrorStatus) {
return;
if (myNonDestructive) {
Standard_Integer iErr;
//
iErr=myErrorStatus;
//
PostTreatCopy();
if (!myErrorStatus) {
myErrorStatus=iErr;
}
}
//
}
//
catch (Standard_Failure) {
if (myNonDestructive) {
PostTreatCopy();
}
}
catch (Standard_Failure) {
//
myErrorStatus=11;
}
}
}
//=======================================================================
@ -202,6 +205,9 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVV& aVV=aVVs(i);
aVV.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@ -212,6 +218,9 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVE& aVE=aVEs(i);
aVE.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@ -222,6 +231,9 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEE& aEE=aEEs(i);
aEE.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@ -232,6 +244,9 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVF& aVF=aVFs(i);
aVF.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@ -245,6 +260,9 @@ void BOPAlgo_CheckerSI::PostTreat()
continue;
}
aEF.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@ -304,6 +322,9 @@ void BOPAlgo_CheckerSI::PostTreat()
//
const BOPDS_InterfVZ& aVZ=aVZs(i);
aVZ.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}

View File

@ -28,6 +28,13 @@
#include <Draw.hxx>
#include <DrawTrSurf.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
@ -35,12 +42,13 @@
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_VectorOfInterfVZ.hxx>
#include <BOPDS_VectorOfInterfEZ.hxx>
#include <BOPDS_VectorOfInterfFZ.hxx>
#include <BOPDS_VectorOfInterfZZ.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_ArgumentAnalyzer.hxx>
#include <BOPAlgo_CheckResult.hxx>
#include <BRepBuilderAPI_Copy.hxx>
static
Standard_Integer bopcheck (Draw_Interpretor&, Standard_Integer, const char** );
@ -79,46 +87,61 @@ Standard_Integer bopcheck
(Draw_Interpretor& di, Standard_Integer n, const char** a )
{
if (n<2) {
di << " Use >bopcheck Shape [level of check: 0 - 5" << "\n";
di << " Use >bopcheck Shape [level of check: 0 - 9" << "\n";
di << " The level of check defines ";
di << " 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";
di << " which interferences will be checked:\n";
di << " 0 - V/V only\n";
di << " 1 - V/V, V/E\n";
di << " 2 - V/V, V/E, E/E\n";
di << " 3 - V/V, V/E, E/E , V/F\n";
di << " 4 - V/V, V/E, E/E, V/F , E/F\n";
di << " 5 - V/V, V/E, E/E, V/F, E/F, F/F;\n";
di << " 6 - V/V, V/E, E/E, V/F, E/F, F/F, V/Z\n";
di << " 7 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z\n";
di << " 8 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z, F/Z\n";
di << " 9 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z, F/Z, Z/Z\n";
di << " Default level is 9\n";
return 1;
}
TopoDS_Shape aS1 = DBRep::Get(a[1]);
if (aS1.IsNull()) {
//
TopoDS_Shape aS = DBRep::Get(a[1]);
if (aS.IsNull()) {
di << "null shapes are not allowed here!";
return 1;
}
TopoDS_Shape aS = aS1;
//
Standard_Integer iErr, aTypeInt, i, ind, j;
Standard_Integer nI1, nI2, theLevelOfCheck;
Standard_Boolean bSelfInt, bFFInt;
Standard_Integer theLevelOfCheck, aNbInterfTypes;
//
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
//
theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
if (theLevelOfCheck > aNbInterfTypes-1) {
di << "Invalid level";
return 1;
}
//-------------------------------------------------------------------
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) {
char type[10][4] = {
"V/V", "V/E", "E/E","V/F", "E/F", "F/F", "V/Z", "E/Z", "F/Z", "Z/Z"
};
Standard_Integer iErr, aTypeInt, i, ind, j, nI1, nI2;
Standard_Boolean bSelfInt, bFFInt;
//
if (theLevelOfCheck >= 0 && theLevelOfCheck < aNbInterfTypes) {
di << "Info:\nThe level of check is set to "
<< type[theLevelOfCheck] << ", i.e. intersection(s)\n";
for (i=theLevelOfCheck+1; i<=5; ++i) {
for (i=theLevelOfCheck+1; i<aNbInterfTypes; ++i) {
di << type[i];
if (i<5) {
if (i<aNbInterfTypes-1) {
di << ", ";
}
}
di << " will not be checked.\n\n";
}
//
BOPAlgo_CheckerSI aChecker;
BOPCol_ListOfShape anArgs;
//
anArgs.Append(aS);
aChecker.SetArguments(anArgs);
aChecker.SetLevelOfCheck(theLevelOfCheck);
@ -133,23 +156,59 @@ Standard_Integer bopcheck
BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF();
BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF();
BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF();
BOPDS_VectorOfInterfVZ& aVZs=theDS->InterfVZ();
BOPDS_VectorOfInterfEZ& aEZs=theDS->InterfEZ();
BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
//
Standard_Integer aNb[6] ={
Standard_Integer aNb[] ={
aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent()
aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(),
aZZs.Extent(),
};
//
bSelfInt = Standard_False;
ind = 0;
for (aTypeInt = 0; aTypeInt < 6; ++aTypeInt) {
for (aTypeInt = 0; aTypeInt < aNbInterfTypes; ++aTypeInt) {
for (i = 0; i < aNb[aTypeInt]; ++i) {
BOPDS_Interf* aInt =
(aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) :
((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) :
((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) :
((aTypeInt==3) ? (BOPDS_Interf*)(&aVFs(i)) :
((aTypeInt==4) ? (BOPDS_Interf*)(&aEFs(i)) :
(BOPDS_Interf*)(&aFFs(i))))));
BOPDS_Interf* aInt=NULL;
//
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
break;
}
//
nI1 = aInt->Index1();
nI2 = aInt->Index2();
@ -157,6 +216,10 @@ Standard_Integer bopcheck
continue;
}
//
if(theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
continue;
}
//
if (aTypeInt == 4) {
BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {

32
tests/bugs/modalg_5/bug24764 Executable file
View File

@ -0,0 +1,32 @@
puts "================"
puts "OCC24764"
puts "================"
puts ""
#######################################################################################
# Alien subshapes occured in result of 'bopcheck' operation
######################################################################################
restore [locate_data_file bug24764_qa.brep] a
bopcheck a 4
set N 16
set qz {}
lappend qz a
for {set i 0} {$i < $N} {incr i} {
lappend qz x${i}
}
eval compound $qz result
set nb_v_good 24
set nb_e_good 24
set nb_w_good 2
set nb_f_good 1
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 2
set nb_shape_good 53
set 2dviewer 1