mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0021264: Modeling Algorithms - Progress indicator for Boolean operations
Update BOP commands to use progress indicator Deleted wrong usage of progress indicator from bop operations Added UserBreak() method to break execution boolean operation if progress indicator is used Added method AnalyzeProgress() to calculate steps of progress indicator Introduce BOPAlgo_ParallelAlgo which has myRange as a field to be used in parallel vector. Provide suitable way of keeping the progress steps of operations. Give meaningful names to progress scopes. Propagate progress indicator into deeper methods of BOA. Add progress indicator to BOPAlgo_BuilderFace and BOPAlgo_WireSplitter, BOPAlgo_BuilderSolid and BOPAlgo_ShellSplitter
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -130,7 +132,8 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
pBuilder->SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
pBuilder->Build();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
pBuilder->Build(aProgress->Start());
|
||||
pBuilder->SimplifyResult(BOPTest_Objects::UnifyEdges(),
|
||||
BOPTest_Objects::UnifyFaces(),
|
||||
BOPTest_Objects::Angular());
|
||||
@@ -197,7 +200,8 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
|
||||
aBuilder.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aBuilder.Build();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aBuilder.Build(aProgress->Start());
|
||||
aBuilder.SimplifyResult(BOPTest_Objects::UnifyEdges(),
|
||||
BOPTest_Objects::UnifyFaces(),
|
||||
BOPTest_Objects::Angular());
|
||||
@@ -257,7 +261,8 @@ Standard_Integer bapisplit(Draw_Interpretor& di,
|
||||
aSplitter.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
// performing operation
|
||||
aSplitter.Build();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aSplitter.Build(aProgress->Start());
|
||||
aSplitter.SimplifyResult(BOPTest_Objects::UnifyEdges(),
|
||||
BOPTest_Objects::UnifyFaces(),
|
||||
BOPTest_Objects::Angular());
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//
|
||||
@@ -145,6 +146,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
//
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
@@ -164,7 +166,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
pPF->SetGlue(aGlue);
|
||||
pPF->SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
//
|
||||
pPF->Perform();
|
||||
pPF->Perform(aProgress->Start());
|
||||
BOPTest::ReportAlerts(pPF->GetReport());
|
||||
//
|
||||
return 0;
|
||||
@@ -247,6 +249,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
//
|
||||
const TopoDS_Shape& aS1=aLC.First();
|
||||
const TopoDS_Shape& aS2=aLC.Last();
|
||||
@@ -258,7 +261,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
|
||||
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
|
||||
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aBOP.PerformWithFiller(*pPF);
|
||||
aBOP.PerformWithFiller(*pPF, aProgress->Start());
|
||||
BOPTest::ReportAlerts(aBOP.GetReport());
|
||||
|
||||
// Store the history of Boolean operation into the session
|
||||
@@ -325,7 +328,8 @@ Standard_Integer bopsection(Draw_Interpretor& di,
|
||||
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
|
||||
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aBOP.PerformWithFiller(*pPF);
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aBOP.PerformWithFiller(*pPF, aProgress->Start());
|
||||
BOPTest::ReportAlerts(aBOP.GetReport());
|
||||
|
||||
// Store the history of Section operation into the session
|
||||
@@ -436,6 +440,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
//
|
||||
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
|
||||
//
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aSec.Approximation(bApp);
|
||||
aSec.ComputePCurveOn1(bPC1);
|
||||
aSec.ComputePCurveOn2(bPC2);
|
||||
@@ -446,8 +451,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
aSec.SetGlue(aGlue);
|
||||
aSec.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
//
|
||||
aSec.Build();
|
||||
|
||||
aSec.Build(aProgress->Start());
|
||||
// Store the history of Section operation into the session
|
||||
if (BRepTest_Objects::IsHistoryNeeded())
|
||||
BRepTest_Objects::SetHistory(aSec.History());
|
||||
@@ -483,10 +487,8 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
const char** a,
|
||||
const BOPAlgo_Operation aOp)
|
||||
{
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
TopoDS_Shape aS1, aS2;
|
||||
TopTools_ListOfShape aLC;
|
||||
Standard_Real aTol;
|
||||
//
|
||||
if (n != 4) {
|
||||
di << " use bx r s1 s2\n";
|
||||
@@ -502,47 +504,30 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
}
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
//
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
Handle(NCollection_BaseAllocator)aAL=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
BOPAlgo_PaveFiller aPF(aAL);
|
||||
//
|
||||
aPF.SetArguments(aLC);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetNonDestructive(bNonDestructive);
|
||||
aPF.SetGlue(aGlue);
|
||||
aPF.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
//
|
||||
aPF.Perform();
|
||||
BOPTest::ReportAlerts(aPF.GetReport());
|
||||
if (aPF.HasErrors()) {
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
BOPAlgo_BOP aBOP(aAL);
|
||||
//
|
||||
aBOP.AddArgument(aS1);
|
||||
aBOP.AddTool(aS2);
|
||||
aBOP.SetOperation(aOp);
|
||||
aBOP.SetRunParallel(bRunParallel);
|
||||
// set options
|
||||
aBOP.SetGlue(BOPTest_Objects::Glue());
|
||||
aBOP.SetFuzzyValue(BOPTest_Objects::FuzzyValue());
|
||||
aBOP.SetNonDestructive(BOPTest_Objects::NonDestructive());
|
||||
aBOP.SetRunParallel(BOPTest_Objects::RunParallel());
|
||||
aBOP.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
|
||||
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aBOP.PerformWithFiller(aPF);
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aBOP.Perform(aProgress->Start());
|
||||
BOPTest::ReportAlerts(aBOP.GetReport());
|
||||
|
||||
// Store the history of Boolean operation into the session
|
||||
if (BRepTest_Objects::IsHistoryNeeded())
|
||||
BRepTest_Objects::SetHistory(aPF.Arguments(), aBOP);
|
||||
BRepTest_Objects::SetHistory(aBOP.PDS()->Arguments(), aBOP);
|
||||
|
||||
if (aBOP.HasErrors()) {
|
||||
return 0;
|
||||
@@ -852,7 +837,8 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
aMV.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
aMV.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aMV.Perform();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aMV.Perform(aProgress->Start());
|
||||
BOPTest::ReportAlerts(aMV.GetReport());
|
||||
|
||||
// Store the history of Volume Maker into the session
|
||||
|
@@ -25,6 +25,8 @@
|
||||
|
||||
#include <BRepTest_Objects.hxx>
|
||||
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
|
||||
static Standard_Integer bcbuild (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bcaddall (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bcremoveall (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
@@ -116,9 +118,9 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
|
||||
aCBuilder.SetUseOBB(BOPTest_Objects::UseOBB());
|
||||
aCBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
aCBuilder.PerformWithFiller(aPF);
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aCBuilder.PerformWithFiller(aPF, aProgress->Start());
|
||||
BOPTest::ReportAlerts(aCBuilder.GetReport());
|
||||
|
||||
// Store the history of the Cells Builder into the session
|
||||
if (BRepTest_Objects::IsHistoryNeeded())
|
||||
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
@@ -243,7 +244,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start();
|
||||
//
|
||||
aChecker.Perform();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aChecker.Perform(aProgress->Start());
|
||||
//
|
||||
aTimer.Stop();
|
||||
//
|
||||
@@ -549,9 +551,9 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
// run checker
|
||||
aChecker.Perform();
|
||||
|
||||
aChecker.Perform(aProgress->Start());
|
||||
// process result of checking
|
||||
if(!aChecker.HasFaulty()) {
|
||||
di << "Shape(s) seem(s) to be valid for BOP." << "\n";
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -138,7 +139,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start();
|
||||
//
|
||||
aPF.Perform();
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
aPF.Perform(aProgress->Start());
|
||||
BOPTest::ReportAlerts(aPF.GetReport());
|
||||
if (aPF.HasErrors()) {
|
||||
return 0;
|
||||
@@ -210,11 +212,12 @@ Standard_Integer bbuild(Draw_Interpretor& di,
|
||||
aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
|
||||
aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
//
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start();
|
||||
//
|
||||
aBuilder.PerformWithFiller(aPF);
|
||||
aBuilder.PerformWithFiller(aPF, aProgress->Start());
|
||||
BOPTest::ReportAlerts(aBuilder.GetReport());
|
||||
|
||||
// Set history of GF operation into the session
|
||||
@@ -327,10 +330,12 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
|
||||
pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
|
||||
//
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
//
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start();
|
||||
//
|
||||
pBuilder->PerformWithFiller(aPF);
|
||||
pBuilder->PerformWithFiller(aPF, aProgress->Start());
|
||||
BOPTest::ReportAlerts(pBuilder->GetReport());
|
||||
|
||||
// Set history of Boolean operation into the session
|
||||
@@ -404,7 +409,8 @@ Standard_Integer bsplit(Draw_Interpretor& di,
|
||||
aTimer.Start();
|
||||
//
|
||||
// perform the operation
|
||||
pSplitter->PerformWithFiller(aPF);
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
pSplitter->PerformWithFiller(aPF, aProgress->Start());
|
||||
//
|
||||
aTimer.Stop();
|
||||
BOPTest::ReportAlerts(pSplitter->GetReport());
|
||||
@@ -567,9 +573,9 @@ Standard_Integer buildbop(Draw_Interpretor& di,
|
||||
|
||||
// Create new report for the operation
|
||||
Handle(Message_Report) aReport = new Message_Report;
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
// Build specific operation
|
||||
pBuilder->BuildBOP(aLObjects, aLTools, anOp, aReport);
|
||||
pBuilder->BuildBOP(aLObjects, aLTools, anOp, aProgress->Start(), aReport);
|
||||
|
||||
// Report alerts of the operation
|
||||
BOPTest::ReportAlerts(aReport);
|
||||
|
Reference in New Issue
Block a user