mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024825: Fit Boolean Operation Algorithm to treat multiple arguments.
class BOPTest class BOPAlgo_BOP class BOPAlgo_Builder class BOPTest class BRepFeat_Builder class BRepFeat_MakeCylindricalHole The format of the command has been changed: bbop r op [-s -t] The following options has been added: -s - run in serial mode -t - print the CPU time Test cases for issue CR24825
This commit is contained in:
@@ -30,6 +30,7 @@ static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , co
|
||||
static Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||
static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||
static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** );
|
||||
static Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||
//
|
||||
//=======================================================================
|
||||
//function :ObjCommands
|
||||
@@ -43,11 +44,12 @@ static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , cons
|
||||
// Chapter's name
|
||||
const char* g = "BOP commands";
|
||||
// Commands
|
||||
theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
|
||||
theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g);
|
||||
theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g);
|
||||
theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g);
|
||||
theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g);
|
||||
theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
|
||||
theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g);
|
||||
theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g);
|
||||
theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g);
|
||||
theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g);
|
||||
theCommands.Add("baddctools" , "baddctools c" , __FILE__, baddctools, g);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : baddcompound
|
||||
@@ -74,6 +76,31 @@ Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const cha
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : baddctools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n<2) {
|
||||
printf(" Use baddctools c\n");
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
TopoDS_Iterator aIt;
|
||||
TopoDS_Shape aS;
|
||||
//
|
||||
aS=DBRep::Get(a[1]);
|
||||
//
|
||||
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
aLT.Append(aSx);
|
||||
}
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
//=======================================================================
|
||||
//function :baddobjects
|
||||
|
@@ -117,10 +117,10 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
|
||||
// Chapter's name
|
||||
const char* g = "Partition commands";
|
||||
// Commands
|
||||
theCommands.Add("bfillds" , "use bfillds [-s -t]" , __FILE__, bfillds, g);
|
||||
theCommands.Add("bbuild" , "use bbuild r [-s -t]", __FILE__, bbuild, g);
|
||||
theCommands.Add("bbop" , "use bbop r op" , __FILE__, bbop, g);
|
||||
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
||||
theCommands.Add("bfillds", "use bfillds [-s -t]" , __FILE__, bfillds, g);
|
||||
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
|
||||
theCommands.Add("bbop" , "use bbop r op [-s -t]", __FILE__, bbop, g);
|
||||
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -314,8 +314,8 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n!=3) {
|
||||
di << " use bbop r op\n";
|
||||
if (n<3) {
|
||||
di << " use bbop r op [-s -t]\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
@@ -326,16 +326,30 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[32];
|
||||
Standard_Integer iErr, iOp;
|
||||
Standard_Boolean bRunParallel, bShowTime;
|
||||
Standard_Integer iErr, iOp, i;
|
||||
BOPAlgo_Operation aOp;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPTime_Chronometer aChrono;
|
||||
//
|
||||
iOp=Draw::Atoi(a[2]);
|
||||
if (iOp<0 || iOp>4) {
|
||||
di << " invalid operation type\n";
|
||||
return 0;
|
||||
}
|
||||
aOp=(BOPAlgo_Operation)iOp;
|
||||
//
|
||||
bShowTime=Standard_False;
|
||||
bRunParallel=Standard_True;
|
||||
for (i=3; i<n; ++i) {
|
||||
if (!strcmp(a[i], "-s")) {
|
||||
bRunParallel=Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-t")) {
|
||||
bShowTime=Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
||||
//
|
||||
BOPAlgo_BOP& aBOP=BOPTest_Objects::BOP();
|
||||
@@ -356,6 +370,9 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
aBOP.SetOperation(aOp);
|
||||
aBOP.SetRunParallel(bRunParallel);
|
||||
//
|
||||
aChrono.Start();
|
||||
//
|
||||
aBOP.PerformWithFiller(aPF);
|
||||
iErr=aBOP.ErrorStatus();
|
||||
@@ -365,6 +382,16 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
aChrono.Stop();
|
||||
//
|
||||
if (bShowTime) {
|
||||
Standard_Real aTime;
|
||||
//
|
||||
aTime=aChrono.Time();
|
||||
Sprintf(buf, " Tps: %7.2lf\n", aTime);
|
||||
di << buf;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aR=aBOP.Shape();
|
||||
if (aR.IsNull()) {
|
||||
di << " null shape\n";
|
||||
|
Reference in New Issue
Block a user