1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00
occt/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx
emv 948fe6ca88 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.
2018-06-14 14:03:06 +03:00

107 lines
3.5 KiB
C++

// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepAlgoAPI_Defeaturing.hxx>
#include <BRepTools_History.hxx>
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_Defeaturing::Build()
{
// Set not done state for the operation
NotDone();
// Clear the tools performing the operation
Clear();
// Set the inputs to BOPAlgo_RemoveFeatures algorithm
myFeatureRemovalTool.SetShape(myInputShape);
myFeatureRemovalTool.AddFacesToRemove(myFacesToRemove);
myFeatureRemovalTool.SetToFillHistory(myFillHistory);
myFeatureRemovalTool.SetRunParallel(myRunParallel);
// Perform the features removal
myFeatureRemovalTool.Perform();
// Merge the Errors/Warnings from the features removal tool
GetReport()->Merge(myFeatureRemovalTool.GetReport());
if (HasErrors())
return;
// Set done state
Done();
// Get the result shape
myShape = myFeatureRemovalTool.Shape();
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Modified(const TopoDS_Shape& theS)
{
return myFeatureRemovalTool.Modified(theS);
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Generated(const TopoDS_Shape& theS)
{
return myFeatureRemovalTool.Generated(theS);
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::IsDeleted(const TopoDS_Shape& theS)
{
return myFeatureRemovalTool.IsDeleted(theS);
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasModified() const
{
return myFeatureRemovalTool.HasModified();
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasGenerated() const
{
return myFeatureRemovalTool.HasGenerated();
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasDeleted() const
{
return myFeatureRemovalTool.HasDeleted();
}