Open CASCADE Technology  7.5.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. More...
 
Setting input data for the algorithm
void SetShape (const TopoDS_Shape &theShape)
 Sets the shape for processing. More...
 
const TopoDS_ShapeInputShape () const
 Returns the input shape. More...
 
void AddFaceToRemove (const TopoDS_Shape &theFace)
 Adds the features to remove from the input shape. More...
 
void AddFacesToRemove (const TopTools_ListOfShape &theFaces)
 Adds the faces to remove from the input shape. More...
 
const TopTools_ListOfShapeFacesToRemove () const
 Returns the list of faces which have been requested for removal from the input shape. More...
 
Performing the operation
virtual void Build () override
 Performs the operation. More...
 
History Methods
void SetToFillHistory (const Standard_Boolean theFlag)
 Defines whether to track the modification of the shapes or not. More...
 
Standard_Boolean HasHistory () const
 Returns whether the history was requested or not. More...
 
virtual const TopTools_ListOfShapeModified (const TopoDS_Shape &theS) override
 Returns the list of shapes modified from the shape <theS> during the operation. More...
 
virtual const TopTools_ListOfShapeGenerated (const TopoDS_Shape &theS) override
 Returns the list of shapes generated from the shape <theS> during the operation. More...
 
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. More...
 
virtual Standard_Boolean HasModified () const
 Returns true if any of the input shapes has been modified during operation. More...
 
virtual Standard_Boolean HasGenerated () const
 Returns true if any of the input shapes has generated shapes during operation. More...
 
virtual Standard_Boolean HasDeleted () const
 Returns true if any of the input shapes has been deleted during operation. More...
 
Handle< BRepTools_HistoryHistory ()
 Returns the History of shapes modifications. More...
 
- Public Member Functions inherited from BRepAlgoAPI_Algo
virtual const TopoDS_ShapeShape () override
 Returns a shape built by the shape construction algorithm. Raises exception StdFail_NotDone if the shape was not built. More...
 
- 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. More...
 

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. More...
 
- Protected Member Functions inherited from BRepAlgoAPI_Algo
 BRepAlgoAPI_Algo ()
 Empty constructor. More...
 
virtual ~BRepAlgoAPI_Algo ()
 Destructor. More...
 
 BRepAlgoAPI_Algo (const Handle< NCollection_BaseAllocator > &theAllocator)
 Empty constructor. More...
 
- Protected Member Functions inherited from BRepBuilderAPI_MakeShape
 BRepBuilderAPI_MakeShape ()
 
- Protected Member Functions inherited from BRepBuilderAPI_Command
 BRepBuilderAPI_Command ()
 Set done to False. More...
 
void Done ()
 Set done to true. More...
 
void NotDone ()
 Set done to false. More...
 
- Protected Member Functions inherited from BOPAlgo_Options
void UserBreak () const
 Breaks the execution if the break signal is indicated by myProgressIndicator. More...
 
 BOPAlgo_Options ()
 Empty constructor. More...
 
 BOPAlgo_Options (const Handle< NCollection_BaseAllocator > &theAllocator)
 Constructor with allocator. More...
 
virtual ~BOPAlgo_Options ()
 Destructor. More...
 
const Handle< NCollection_BaseAllocator > & Allocator () const
 Returns allocator. More...
 
void AddError (const Handle< Message_Alert > &theAlert)
 Adds the alert as error (fail) More...
 
void AddWarning (const Handle< Message_Alert > &theAlert)
 Adds the alert as warning. More...
 
Standard_Boolean HasErrors () const
 Returns true if algorithm has failed. More...
 
Standard_Boolean HasError (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated error of specified type. More...
 
Standard_Boolean HasWarnings () const
 Returns true if algorithm has generated some warning alerts. More...
 
Standard_Boolean HasWarning (const Handle< Standard_Type > &theType) const
 Returns true if algorithm has generated warning of specified type. More...
 
const Handle< Message_Report > & GetReport () const
 Returns report collecting all errors and warnings. More...
 
void DumpErrors (Standard_OStream &theOS) const
 Dumps the error status into the given stream. More...
 
void DumpWarnings (Standard_OStream &theOS) const
 Dumps the warning statuses into the given stream. More...
 
void ClearWarnings ()
 Clears the warnings of the algorithm. More...
 
void SetFuzzyValue (const Standard_Real theFuzz)
 Sets the additional tolerance. More...
 
Standard_Real FuzzyValue () const
 Returns the additional tolerance. More...
 
void SetProgressIndicator (const Message_ProgressScope &theProgress)
 Set the Progress Indicator object. More...
 
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. More...
 
Standard_Boolean RunParallel () const
 Returns the flag of parallel processing. More...
 
void SetUseOBB (const Standard_Boolean theUseOBB)
 Enables/Disables the usage of OBB. More...
 
Standard_Boolean UseOBB () const
 Returns the flag defining usage of OBB. More...
 

Protected Attributes

Fields
TopoDS_Shape myInputShape
 Input shape to remove the features from. More...
 
TopTools_ListOfShape myFacesToRemove
 Features to remove from the shape. More...
 
Standard_Boolean myFillHistory
 Defines whether to track the history of shapes modifications or not (true by default) More...
 
BOPAlgo_RemoveFeatures myFeatureRemovalTool
 Tool for the features removal. More...
 
- 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. More...
 
Handle< Message_ReportmyReport
 Enables/Disables the usage of OBB. More...
 
Standard_Boolean myRunParallel
 Enables/Disables the usage of OBB. More...
 
Standard_Real myFuzzyValue
 Enables/Disables the usage of OBB. More...
 
const Message_ProgressScopemyProgressScope
 Enables/Disables the usage of OBB. More...
 
Standard_Boolean myUseOBB
 Enables/Disables the usage of OBB. More...
 

Additional Inherited Members

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

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
Standard_SStream aSStream;
aDF.DumpErrors(aSStream);
return;
}
if (aDF.HasWarnings()) // Check for the warnings
{
// warnings treatment
Standard_SStream aSStream;
aDF.DumpWarnings(aSStream);
}
const TopoDS_Shape& aResult = aDF.Shape(); // Result shape

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 ( )
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 BOPAlgo_Options.

◆ 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: