Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
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

Empty constructor

 BRepAlgoAPI_Defeaturing ()
 
Setting input data for the algorithm

Sets the shape for processing.

Parameters
[in]theShapeThe shape to remove the features from. It should either be the SOLID, COMPSOLID or COMPOUND of Solids.
void SetShape (const TopoDS_Shape &theShape)
 Returns the input shape.
 
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 NCollection_List< TopoDS_Shape > &theFaces)
 Adds the faces to remove from the input shape.
 
const NCollection_List< TopoDS_Shape > & FacesToRemove () const
 Returns the list of faces which have been requested for removal from the input shape.
 
Performing the operation

Performs the operation

void Build (const Message_ProgressRange &theRange=Message_ProgressRange()) override
 This is called by Shape(). It does nothing but may be redefined.
 
History Methods

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

void SetToFillHistory (const bool theFlag)
 Returns whether the history was requested or not.
 
bool HasHistory () const
 Returns whether the history was requested or not.
 
const NCollection_List< TopoDS_Shape > & Modified (const TopoDS_Shape &theS) override
 Returns the list of shapes modified from the shape <theS> during the operation.
 
const NCollection_List< TopoDS_Shape > & Generated (const TopoDS_Shape &theS) override
 Returns the list of shapes generated from the shape <theS> during the operation.
 
bool 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 bool HasModified () const
 Returns true if any of the input shapes has been modified during operation.
 
virtual bool HasGenerated () const
 Returns true if any of the input shapes has generated shapes during operation.
 
virtual bool HasDeleted () const
 Returns true if any of the input shapes has been deleted during operation.
 
occ::handle< BRepTools_HistoryHistory ()
 Returns the History of shapes modifications.
 
- Public Member Functions inherited from BRepAlgoAPI_Algo
const TopoDS_ShapeShape () override
 Returns a shape built by the shape construction algorithm. Does not check if the shape is built.
 
void ClearWarnings ()
 Clears the warnings of the algorithm.
 
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.
 
double FuzzyValue () const
 Returns the additional tolerance.
 
const occ::handle< Message_Report > & GetReport () const
 Returns report collecting all errors and warnings.
 
bool HasError (const occ::handle< Standard_Type > &theType) const
 Returns true if algorithm has generated error of specified type.
 
bool HasErrors () const
 Returns true if algorithm has failed.
 
bool HasWarning (const occ::handle< Standard_Type > &theType) const
 Returns true if algorithm has generated warning of specified type.
 
bool HasWarnings () const
 Returns true if algorithm has generated some warning alerts.
 
bool RunParallel () const
 Returns the flag of parallel processing.
 
void SetFuzzyValue (const double theFuzz)
 Sets the additional tolerance.
 
void SetRunParallel (const bool 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.
 
void SetUseOBB (const bool 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 bool IsDone () const
 
void Check () const
 Raises NotDone if done is false.
 

Protected Member Functions

Setting the algorithm into default state
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.
 
 ~BRepAlgoAPI_Algo () override
 Destructor.
 
 BRepAlgoAPI_Algo (const occ::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
bool 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 occ::handle< NCollection_BaseAllocator > &theAllocator)
 Constructor with allocator.
 
virtual ~BOPAlgo_Options ()
 Destructor.
 
const occ::handle< NCollection_BaseAllocator > & Allocator () const
 Returns allocator.
 
void AddError (const occ::handle< Message_Alert > &theAlert)
 Adds the alert as error (fail)
 
void AddWarning (const occ::handle< Message_Alert > &theAlert)
 Adds the alert as warning.
 
bool HasErrors () const
 Returns true if algorithm has failed.
 
bool HasError (const occ::handle< Standard_Type > &theType) const
 Returns true if algorithm has generated error of specified type.
 
bool HasWarnings () const
 Returns true if algorithm has generated some warning alerts.
 
bool HasWarning (const occ::handle< Standard_Type > &theType) const
 Returns true if algorithm has generated warning of specified type.
 
const occ::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 double theFuzz)
 Sets the additional tolerance.
 
double FuzzyValue () const
 Returns the additional tolerance.
 
void SetUseOBB (const bool theUseOBB)
 Enables/Disables the usage of OBB.
 
bool UseOBB () const
 Returns the flag defining usage of OBB.
 
void SetRunParallel (const bool 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.
 
bool RunParallel () const
 Returns the flag of parallel processing.
 

Protected Attributes

Fields
TopoDS_Shape myInputShape
 Input shape to remove the features from.
 
NCollection_List< TopoDS_ShapemyFacesToRemove
 Features to remove from the shape.
 
bool 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
 
NCollection_List< TopoDS_ShapemyGenerated
 
- Protected Attributes inherited from BOPAlgo_Options
occ::handle< NCollection_BaseAllocatormyAllocator
 Enables/Disables the usage of OBB.
 
occ::handle< Message_ReportmyReport
 Enables/Disables the usage of OBB.
 
bool myRunParallel
 Enables/Disables the usage of OBB.
 
double myFuzzyValue
 Enables/Disables the usage of OBB.
 
bool myUseOBB
 Enables/Disables the usage of OBB.
 

Additional Inherited Members

- Static Protected Member Functions inherited from BOPAlgo_Options
static bool GetParallelMode ()
 Gets the global parallel mode.
 
static void SetParallelMode (const bool 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
NCollection_List<TopoDS_Shape> aFeatures = ...; // Features to remove from the shape
bool bRunParallel = ...; // Parallel processing mode
bool 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:101
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
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

Member Function Documentation

◆ AddFacesToRemove()

void BRepAlgoAPI_Defeaturing::AddFacesToRemove ( const NCollection_List< TopoDS_Shape > & theFaces)
inline

Adds the faces to remove from the input shape.

Parameters
[in]theFacesThe 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
[in]theFaceThe shape to extract the faces for removal.

◆ Build()

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

This is called by Shape(). It does nothing but may be redefined.

Reimplemented from BRepBuilderAPI_MakeShape.

◆ Clear()

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 NCollection_List< TopoDS_Shape > & BRepAlgoAPI_Defeaturing::FacesToRemove ( ) const
inline

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

◆ Generated()

const NCollection_List< TopoDS_Shape > & 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 bool BRepAlgoAPI_Defeaturing::HasDeleted ( ) const
virtual

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

◆ HasGenerated()

virtual bool BRepAlgoAPI_Defeaturing::HasGenerated ( ) const
virtual

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

◆ HasHistory()

bool BRepAlgoAPI_Defeaturing::HasHistory ( ) const
inline

Returns whether the history was requested or not.

◆ HasModified()

virtual bool BRepAlgoAPI_Defeaturing::HasModified ( ) const
virtual

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

◆ History()

occ::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()

bool 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()

const NCollection_List< TopoDS_Shape > & 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

Returns the input shape.

◆ SetToFillHistory()

void BRepAlgoAPI_Defeaturing::SetToFillHistory ( const bool theFlag)
inline

Returns whether the history was requested or not.

Field Documentation

◆ myFacesToRemove

NCollection_List<TopoDS_Shape> BRepAlgoAPI_Defeaturing::myFacesToRemove
protected

Features to remove from the shape.

◆ myFeatureRemovalTool

BOPAlgo_RemoveFeatures BRepAlgoAPI_Defeaturing::myFeatureRemovalTool
protected

Tool for the features removal.

◆ myFillHistory

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