Open CASCADE Technology 7.8.0
BRepAlgoAPI_Defeaturing Class Reference

The BRepAlgoAPI_Defeaturing algorithm is the API algorithm intended for removal of the unwanted parts from the shape. The unwanted parts (or features) can be holes, protrusions, gaps, chamfers, fillets etc. The shape itself is not modified, the new shape is built as the result. More...

#include <BRepAlgoAPI_Defeaturing.hxx>

Inheritance diagram for BRepAlgoAPI_Defeaturing:
Inheritance graph
[legend]

Public Member Functions

Constructors
 BRepAlgoAPI_Defeaturing ()
 Empty constructor.
 
Setting input data for the algorithm
void SetShape (const TopoDS_Shape &theShape)
 Sets the shape for processing.
 
const TopoDS_ShapeInputShape () const
 Returns the input shape.
 
void AddFaceToRemove (const TopoDS_Shape &theFace)
 Adds the features to remove from the input shape.
 
void AddFacesToRemove (const TopTools_ListOfShape &theFaces)
 Adds the faces to remove from the input shape.
 
const TopTools_ListOfShapeFacesToRemove () const
 Returns the list of faces which have been requested for removal from the input shape.
 
Performing the operation
virtual void Build (const Message_ProgressRange &theRange=Message_ProgressRange()) override
 Performs the operation.
 
History Methods
void SetToFillHistory (const Standard_Boolean theFlag)
 Defines whether to track the modification of the shapes or not.
 
Standard_Boolean HasHistory () const
 Returns whether the history was requested or not.
 
virtual const TopTools_ListOfShapeModified (const TopoDS_Shape &theS) override
 Returns the list of shapes modified from the shape <theS> during the operation.
 
virtual const TopTools_ListOfShapeGenerated (const TopoDS_Shape &theS) override
 Returns the list of shapes generated from the shape <theS> during the operation.
 
virtual Standard_Boolean IsDeleted (const TopoDS_Shape &theS) override
 Returns true if the shape <theS> has been deleted during the operation. It means that the shape has no any trace in the result. Otherwise it returns false.
 
virtual Standard_Boolean HasModified () const
 Returns true if any of the input shapes has been modified during operation.
 
virtual Standard_Boolean HasGenerated () const
 Returns true if any of the input shapes has generated shapes during operation.
 
virtual Standard_Boolean HasDeleted () const
 Returns true if any of the input shapes has been deleted during operation.
 
Handle< BRepTools_HistoryHistory ()
 Returns the History of shapes modifications.
 
- Public Member Functions inherited from BRepAlgoAPI_Algo
virtual const TopoDS_ShapeShape () override
 Returns a shape built by the shape construction algorithm. Does not check if the shape is built.
 
void SetRunParallel (const Standard_Boolean theFlag)
 Set the flag of parallel processing if <theFlag> is true the parallel processing is switched on if <theFlag> is false the parallel processing is switched off.
 
Standard_Boolean RunParallel () const
 Returns the flag of parallel processing.
 
void SetFuzzyValue (const Standard_Real theFuzz)
 Sets the additional tolerance.
 
Standard_Real FuzzyValue () const
 Returns the additional tolerance.
 
Standard_Boolean HasErrors () const
 Returns true if algorithm has failed.
 
Standard_Boolean HasWarnings () const
 Returns true if algorithm has generated some warning alerts.
 
Standard_Boolean HasError (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated error of specified type.
 
Standard_Boolean HasWarning (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated warning of specified type.
 
void DumpErrors (Standard_OStream &theOS) const
 Dumps the error status into the given stream.
 
void DumpWarnings (Standard_OStream &theOS) const
 Dumps the warning statuses into the given stream.
 
void ClearWarnings ()
 Clears the warnings of the algorithm.
 
const Handle< Message_Report > & GetReport () const
 Returns report collecting all errors and warnings.
 
void SetUseOBB (const Standard_Boolean theUseOBB)
 Enables/Disables the usage of OBB.
 
- Public Member Functions inherited from BRepBuilderAPI_MakeShape
 operator TopoDS_Shape ()
 
- Public Member Functions inherited from BRepBuilderAPI_Command
virtual ~BRepBuilderAPI_Command ()
 
virtual Standard_Boolean IsDone () const
 
void Check () const
 Raises NotDone if done is false.
 

Protected Member Functions

Setting the algorithm into default state
virtual void Clear () override
 Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.
 
- Protected Member Functions inherited from BRepAlgoAPI_Algo
 BRepAlgoAPI_Algo ()
 Empty constructor.
 
virtual ~BRepAlgoAPI_Algo ()
 Destructor.
 
 BRepAlgoAPI_Algo (const Handle< NCollection_BaseAllocator > &theAllocator)
 Empty constructor.
 
- Protected Member Functions inherited from BRepBuilderAPI_MakeShape
 BRepBuilderAPI_MakeShape ()
 
- Protected Member Functions inherited from BRepBuilderAPI_Command
 BRepBuilderAPI_Command ()
 Set done to False.
 
void Done ()
 Set done to true.
 
void NotDone ()
 Set done to false.
 
- Protected Member Functions inherited from BOPAlgo_Options
Standard_Boolean UserBreak (const Message_ProgressScope &thePS)
 Adds error to the report if the break signal was caught. Returns true in this case, false otherwise.
 
 BOPAlgo_Options ()
 Empty constructor.
 
 BOPAlgo_Options (const Handle< NCollection_BaseAllocator > &theAllocator)
 Constructor with allocator.
 
virtual ~BOPAlgo_Options ()
 Destructor.
 
const Handle< NCollection_BaseAllocator > & Allocator () const
 Returns allocator.
 
void AddError (const Handle< Message_Alert > &theAlert)
 Adds the alert as error (fail)
 
void AddWarning (const Handle< Message_Alert > &theAlert)
 Adds the alert as warning.
 
Standard_Boolean HasErrors () const
 Returns true if algorithm has failed.
 
Standard_Boolean HasError (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated error of specified type.
 
Standard_Boolean HasWarnings () const
 Returns true if algorithm has generated some warning alerts.
 
Standard_Boolean HasWarning (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated warning of specified type.
 
const Handle< Message_Report > & GetReport () const
 Returns report collecting all errors and warnings.
 
void DumpErrors (Standard_OStream &theOS) const
 Dumps the error status into the given stream.
 
void DumpWarnings (Standard_OStream &theOS) const
 Dumps the warning statuses into the given stream.
 
void ClearWarnings ()
 Clears the warnings of the algorithm.
 
void SetFuzzyValue (const Standard_Real theFuzz)
 Sets the additional tolerance.
 
Standard_Real FuzzyValue () const
 Returns the additional tolerance.
 
void SetUseOBB (const Standard_Boolean theUseOBB)
 Enables/Disables the usage of OBB.
 
Standard_Boolean UseOBB () const
 Returns the flag defining usage of OBB.
 
void SetRunParallel (const Standard_Boolean theFlag)
 Set the flag of parallel processing if <theFlag> is true the parallel processing is switched on if <theFlag> is false the parallel processing is switched off.
 
Standard_Boolean RunParallel () const
 Returns the flag of parallel processing.
 

Protected Attributes

Fields
TopoDS_Shape myInputShape
 Input shape to remove the features from.
 
TopTools_ListOfShape myFacesToRemove
 Features to remove from the shape.
 
Standard_Boolean myFillHistory
 Defines whether to track the history of shapes modifications or not (true by default)
 
BOPAlgo_RemoveFeatures myFeatureRemovalTool
 Tool for the features removal.
 
- Protected Attributes inherited from BRepBuilderAPI_MakeShape
TopoDS_Shape myShape
 
TopTools_ListOfShape myGenerated
 
- Protected Attributes inherited from BOPAlgo_Options
Handle< NCollection_BaseAllocatormyAllocator
 Enables/Disables the usage of OBB.
 
Handle< Message_ReportmyReport
 Enables/Disables the usage of OBB.
 
Standard_Boolean myRunParallel
 Enables/Disables the usage of OBB.
 
Standard_Real myFuzzyValue
 Enables/Disables the usage of OBB.
 
Standard_Boolean myUseOBB
 Enables/Disables the usage of OBB.
 

Additional Inherited Members

- Static Protected Member Functions inherited from BOPAlgo_Options
static Standard_Boolean GetParallelMode ()
 Gets the global parallel mode.
 
static void SetParallelMode (const Standard_Boolean theNewMode)
 Sets the global parallel mode.
 

Detailed Description

The BRepAlgoAPI_Defeaturing algorithm is the API algorithm intended for removal of the unwanted parts from the shape. The unwanted parts (or features) can be holes, protrusions, gaps, chamfers, fillets etc. The shape itself is not modified, the new shape is built as the result.

The actual removal of the features from the shape is performed by the low-level BOPAlgo_RemoveFeatures tool. So the defeaturing algorithm has the same options, input data requirements, limitations as the low-level algorithm.

Input data

Currently, only the shapes of type SOLID, COMPSOLID, and COMPOUND of Solids are supported. And only the FACEs can be removed from the shape.

On the input the algorithm accepts the shape itself and the features which have to be removed. It does not matter how the features are given. It could be the separate faces or the collections of faces. The faces should belong to the initial shape, and those that do not belong will be ignored.

Options

The algorithm has the following options:

and the options available from base class:

Please note that the other options of the base class are not supported here and will have no effect.

For the details on the available options please refer to the description of BOPAlgo_RemoveFeatures algorithm.

Limitations

The defeaturing algorithm has the same limitations as BOPAlgo_RemoveFeatures algorithm.

Example

Here is the example of usage of the algorithm:

TopoDS_Shape aSolid = ...; // Input shape to remove the features from
TopTools_ListOfShape aFeatures = ...; // Features to remove from the shape
Standard_Boolean bRunParallel = ...; // Parallel processing mode
Standard_Boolean isHistoryNeeded = ...; // History support
BRepAlgoAPI_Defeaturing aDF; // De-Featuring algorithm
aDF.SetShape(aSolid); // Set the shape
aDF.AddFacesToRemove(aFaces); // Add faces to remove
aDF.SetRunParallel(bRunParallel); // Define the processing mode (parallel or single)
aDF.SetToFillHistory(isHistoryNeeded); // Define whether to track the shapes modifications
aDF.Build(); // Perform the operation
if (!aDF.IsDone()) // Check for the errors
{
// error treatment
aDF.DumpErrors(aSStream);
return;
}
if (aDF.HasWarnings()) // Check for the warnings
{
// warnings treatment
aDF.DumpWarnings(aSStream);
}
const TopoDS_Shape& aResult = aDF.Shape(); // Result shape
std::stringstream Standard_SStream
Defines Standard_SStream as typedef to C++ string stream.
Definition Standard_SStream.hxx:21
The BRepAlgoAPI_Defeaturing algorithm is the API algorithm intended for removal of the unwanted parts...
Definition BRepAlgoAPI_Defeaturing.hxx:102
Definition NCollection_UBTree.hxx:64
Describes a shape which.
Definition TopoDS_Shape.hxx:41

The algorithm preserves the type of the input shape in the result shape. Thus, if the input shape is a COMPSOLID, the resulting solids will also be put into a COMPSOLID.

Constructor & Destructor Documentation

◆ BRepAlgoAPI_Defeaturing()

BRepAlgoAPI_Defeaturing::BRepAlgoAPI_Defeaturing ( )
inline

Empty constructor.

Member Function Documentation

◆ AddFacesToRemove()

void BRepAlgoAPI_Defeaturing::AddFacesToRemove ( const TopTools_ListOfShape theFaces)
inline

Adds the faces to remove from the input shape.

Parameters
theFaces[in] The list of shapes to extract the faces for removal.

◆ AddFaceToRemove()

void BRepAlgoAPI_Defeaturing::AddFaceToRemove ( const TopoDS_Shape theFace)
inline

Adds the features to remove from the input shape.

Parameters
theFace[in] The shape to extract the faces for removal.

◆ Build()

virtual void BRepAlgoAPI_Defeaturing::Build ( const Message_ProgressRange theRange = Message_ProgressRange())
overridevirtual

Performs the operation.

Reimplemented from BRepBuilderAPI_MakeShape.

◆ Clear()

virtual void BRepAlgoAPI_Defeaturing::Clear ( )
inlineoverrideprotectedvirtual

Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.

Reimplemented from BRepAlgoAPI_Algo.

◆ FacesToRemove()

const TopTools_ListOfShape & BRepAlgoAPI_Defeaturing::FacesToRemove ( ) const
inline

Returns the list of faces which have been requested for removal from the input shape.

◆ Generated()

virtual const TopTools_ListOfShape & BRepAlgoAPI_Defeaturing::Generated ( const TopoDS_Shape theS)
overridevirtual

Returns the list of shapes generated from the shape <theS> during the operation.

Reimplemented from BRepBuilderAPI_MakeShape.

◆ HasDeleted()

virtual Standard_Boolean BRepAlgoAPI_Defeaturing::HasDeleted ( ) const
virtual

Returns true if any of the input shapes has been deleted during operation.

◆ HasGenerated()

virtual Standard_Boolean BRepAlgoAPI_Defeaturing::HasGenerated ( ) const
virtual

Returns true if any of the input shapes has generated shapes during operation.

◆ HasHistory()

Standard_Boolean BRepAlgoAPI_Defeaturing::HasHistory ( ) const
inline

Returns whether the history was requested or not.

◆ HasModified()

virtual Standard_Boolean BRepAlgoAPI_Defeaturing::HasModified ( ) const
virtual

Returns true if any of the input shapes has been modified during operation.

◆ History()

Handle< BRepTools_History > BRepAlgoAPI_Defeaturing::History ( )
inline

Returns the History of shapes modifications.

◆ InputShape()

const TopoDS_Shape & BRepAlgoAPI_Defeaturing::InputShape ( ) const
inline

Returns the input shape.

◆ IsDeleted()

virtual Standard_Boolean BRepAlgoAPI_Defeaturing::IsDeleted ( const TopoDS_Shape theS)
overridevirtual

Returns true if the shape <theS> has been deleted during the operation. It means that the shape has no any trace in the result. Otherwise it returns false.

Reimplemented from BRepBuilderAPI_MakeShape.

◆ Modified()

virtual const TopTools_ListOfShape & BRepAlgoAPI_Defeaturing::Modified ( const TopoDS_Shape theS)
overridevirtual

Returns the list of shapes modified from the shape <theS> during the operation.

Reimplemented from BRepBuilderAPI_MakeShape.

◆ SetShape()

void BRepAlgoAPI_Defeaturing::SetShape ( const TopoDS_Shape theShape)
inline

Sets the shape for processing.

Parameters
theShape[in] The shape to remove the features from. It should either be the SOLID, COMPSOLID or COMPOUND of Solids.

◆ SetToFillHistory()

void BRepAlgoAPI_Defeaturing::SetToFillHistory ( const Standard_Boolean  theFlag)
inline

Defines whether to track the modification of the shapes or not.

Field Documentation

◆ myFacesToRemove

TopTools_ListOfShape BRepAlgoAPI_Defeaturing::myFacesToRemove
protected

Features to remove from the shape.

◆ myFeatureRemovalTool

BOPAlgo_RemoveFeatures BRepAlgoAPI_Defeaturing::myFeatureRemovalTool
protected

Tool for the features removal.

◆ myFillHistory

Standard_Boolean BRepAlgoAPI_Defeaturing::myFillHistory
protected

Defines whether to track the history of shapes modifications or not (true by default)

◆ myInputShape

TopoDS_Shape BRepAlgoAPI_Defeaturing::myInputShape
protected

Input shape to remove the features from.


The documentation for this class was generated from the following file: