1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028747: Incorrect result of the section operation after edge refinement

Implementation of the method for simplification of the result of Boolean Operation on the API level.
The method BRepAlgoAPI_BuilderAlgo::SimplifyResult has been added, so the derived classes such as BooleanOpeation and Splitter can also use this method.
The result shape simplification should be called after the operation is done. The simplification is performed by the means of ShapeUpgrade_UnifySameDomain algorithm.

Draw command "bsimplify" has been added to control the simplification options.
Documentation for new functionality and draw commands controlling the options of Boolean operations.
Test cases for the new functionality.

Side-effect change:
The algorithms in Boolean component have been changed to use the BRepTools_History as a History tool.
Now it became possible to disable the collection of shapes modifications during Boolean Operations, which may be useful for performance sake (in draw the option is controlled by *setfillhistory* command).
Draw command "unifysamedom" has been changed to accept the angular tolerance in degrees instead of radians.
This commit is contained in:
emv
2018-04-26 14:35:35 +03:00
committed by bugmaster
parent 894dba72a3
commit 948fe6ca88
58 changed files with 2139 additions and 1783 deletions

View File

@@ -2238,9 +2238,12 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
dout.Flush();
// Save history for fillet
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
}
return 0;
}

View File

@@ -179,9 +179,12 @@ static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const
if(!Rakk->IsDone()) return 1;
// Save history for fillet
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
}
TopoDS_Shape res = Rakk->Shape();
DBRep::Set(a[1],res);

View File

@@ -26,10 +26,11 @@
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
static Standard_Integer SaveHistory(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Modified (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Generated (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer IsDeleted (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer SetFillHistory(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer SaveHistory (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Modified (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Generated (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer IsDeleted (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : HistoryCommands
@@ -44,6 +45,13 @@ void BRepTest::HistoryCommands(Draw_Interpretor& theCommands)
const char* group = "History commands";
// Commands
theCommands.Add("setfillhistory" , "Controls the history collection by the algorithms and its saving into the session after algorithm is done.\n"
"\t\tUsage: setfillhistory [flag]\n"
"\t\tw/o arguments prints the current state of the option;\n"
"\t\tflag == 0 - history will not be collected and saved;\n"
"\t\tflag != 0 - history will be collected and saved into the session (default).",
__FILE__, SetFillHistory , group);
theCommands.Add("savehistory" , "savehistory name\n"
"\t\tSaves the history from the session into a drawable object with the name <name>.",
__FILE__, SaveHistory , group);
@@ -61,6 +69,33 @@ void BRepTest::HistoryCommands(Draw_Interpretor& theCommands)
__FILE__, IsDeleted, group);
}
//=======================================================================
//function : SetFillHistory
//purpose :
//=======================================================================
Standard_Integer SetFillHistory(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char** theArgv)
{
if (theArgc > 2)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
if (theArgc == 1)
{
theDI << "Filling of the history is " <<
(BRepTest_Objects::IsHistoryNeeded() ? "enabled." : "disabled.");
}
else
{
Standard_Integer iHist = Draw::Atoi(theArgv[1]);
BRepTest_Objects::SetToFillHistory(iHist != 0);
}
return 0;
}
//=======================================================================
//function : SaveHistory
//purpose :

View File

@@ -24,7 +24,16 @@ class BRepTest_Session
public:
//! Empty constructor
BRepTest_Session() {}
BRepTest_Session()
{
SetDefaultValues();
}
//! Sets the default values for the options
void SetDefaultValues()
{
myFillHistory = Standard_True;
}
//! Sets the History in the session
void SetHistory(const Handle(BRepTools_History)& theHistory)
@@ -46,9 +55,19 @@ public:
return myHistory;
}
//! Enables/Disables the history saving
void SetToFillHistory(const Standard_Boolean theFillHist)
{
myFillHistory = theFillHist;
}
//! Returns the flag controlling the history saving
Standard_Boolean IsHistoryNeeded() const { return myFillHistory; }
private:
Handle(BRepTools_History) myHistory;
Standard_Boolean myFillHistory;
};
//=======================================================================
@@ -87,3 +106,21 @@ Handle(BRepTools_History) BRepTest_Objects::History()
{
return GetSession().History();
}
//=======================================================================
//function : SetToFillHistory
//purpose :
//=======================================================================
void BRepTest_Objects::SetToFillHistory(const Standard_Boolean theFillHist)
{
return GetSession().SetToFillHistory(theFillHist);
}
//=======================================================================
//function : IsHistoryNeeded
//purpose :
//=======================================================================
Standard_Boolean BRepTest_Objects::IsHistoryNeeded()
{
return GetSession().IsHistoryNeeded();
}

View File

@@ -47,6 +47,13 @@ public:
//! Returns the history from the session.
Standard_EXPORT static Handle(BRepTools_History) History();
//! Enables/Disables the history saving
Standard_EXPORT static void SetToFillHistory(const Standard_Boolean theFillHist);
//! Returns the flag controlling the history collection
Standard_EXPORT static Standard_Boolean IsHistoryNeeded();
};
#endif

View File

@@ -431,7 +431,8 @@ Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char*
TopoDS_Shape Shell = Generator->Shape();
DBRep::Set(a[index-1], Shell);
// Save history of the lofting
BRepTest_Objects::SetHistory(Generator->Wires(), *Generator);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(Generator->Wires(), *Generator);
}
else {
cout << "Algorithm is not done" << endl;
@@ -776,9 +777,12 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
result = Sweep->Shape();
DBRep::Set(a[1],result);
// Save history of sweep
TopTools_ListOfShape aProfiles;
Sweep->Profiles(aProfiles);
BRepTest_Objects::SetHistory(aProfiles, *Sweep);
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape aProfiles;
Sweep->Profiles(aProfiles);
BRepTest_Objects::SetHistory(aProfiles, *Sweep);
}
}
return 0;