Open CASCADE Technology  7.4.0

BOPAlgo_RemoveFeatures Class Reference

The RemoveFeatures algorithm is intended for reconstruction of the shape by removal of the unwanted parts from it. These parts can be holes, protrusions, spikes, fillets etc. The shape itself is not modified, the new shape is built in the result. More...

#include <BOPAlgo_RemoveFeatures.hxx>

Inheritance diagram for BOPAlgo_RemoveFeatures:
Inheritance graph
[legend]

Public Member Functions

Constructors
 BOPAlgo_RemoveFeatures ()
 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 face 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 Perform () override
 Performs the operation. More...
 
Clearing the contents of the algorithm
virtual void Clear () override
 Clears the contents of the algorithm from previous run, allowing reusing it for following removals. More...
 
- Public Member Functions inherited from BOPAlgo_BuilderShape
const TopoDS_ShapeShape () const
 Returns the result of algorithm. More...
 
const TopTools_ListOfShapeModified (const TopoDS_Shape &theS)
 Returns the list of shapes Modified from the shape theS. More...
 
const TopTools_ListOfShapeGenerated (const TopoDS_Shape &theS)
 Returns the list of shapes Generated from the shape theS. More...
 
Standard_Boolean IsDeleted (const TopoDS_Shape &theS)
 Returns true if the shape theS has been deleted. In this case the shape will have no Modified elements, but can have Generated elements. More...
 
Standard_Boolean HasModified () const
 Returns true if any of the input shapes has been modified during operation. More...
 
Standard_Boolean HasGenerated () const
 Returns true if any of the input shapes has generated shapes during operation. More...
 
Standard_Boolean HasDeleted () const
 Returns true if any of the input shapes has been deleted during operation. More...
 
Handle< BRepTools_HistoryHistory ()
 History Tool. More...
 
void SetToFillHistory (const Standard_Boolean theHistFlag)
 Allows disabling the history collection. More...
 
Standard_Boolean HasHistory () const
 Returns flag of history availability. More...
 
- Public Member Functions inherited from BOPAlgo_Options
 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 Handle< Message_ProgressIndicator > &theObj)
 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 Member Functions

Protected methods performing the removal
virtual void CheckData () override
 Checks the input data on validity for the algorithm: More...
 
void PrepareFeatures ()
 Prepares the faces to remove: More...
 
void RemoveFeatures ()
 Removes the features and fills the created gaps by extension of the adjacent faces. Processes each feature separately. More...
 
void RemoveFeature (const TopoDS_Shape &theFeature, const TopTools_IndexedMapOfShape &theSolids, const TopTools_MapOfShape &theFeatureFacesMap, const Standard_Boolean theHasAdjacentFaces, const TopTools_IndexedDataMapOfShapeListOfShape &theAdjFaces, const Handle< BRepTools_History > &theAdjFacesHistory, const Standard_Boolean theSolidsHistoryNeeded)
 Remove the single feature from the shape. More...
 
void UpdateHistory ()
 Updates history with the removed features. More...
 
void SimplifyResult ()
 Simplifies the result by removing extra edges and vertices created during removal of the features. More...
 
void PostTreat ()
 Post treatment - restore the type of the initial shape. More...
 
- Protected Member Functions inherited from BOPAlgo_BuilderShape
 BOPAlgo_BuilderShape ()
 Empty constructor. More...
 
 BOPAlgo_BuilderShape (const Handle< NCollection_BaseAllocator > &theAllocator)
 Constructor with allocator. More...
 
- Protected Member Functions inherited from BOPAlgo_Algo
 BOPAlgo_Algo ()
 Default constructor. More...
 
virtual ~BOPAlgo_Algo ()
 
 BOPAlgo_Algo (const Handle< NCollection_BaseAllocator > &theAllocator)
 
virtual void CheckResult ()
 Checks the obtained result. More...
 
- Protected Member Functions inherited from BOPAlgo_Options
void UserBreak () const
 Breaks the execution if the break signal is indicated by myProgressIndicator. More...
 

Protected Attributes

Fields
TopoDS_Shape myInputShape
 Input shape. More...
 
TopTools_ListOfShape myFacesToRemove
 Faces to remove. More...
 
TopTools_ListOfShape myFeatures
 List of not connected features to remove (each feature is a compound of faces) More...
 
TopTools_IndexedMapOfShape myInputsMap
 Map of all sub-shapes of the input shape. More...
 
- Protected Attributes inherited from BOPAlgo_BuilderShape
TopoDS_Shape myShape
 Result of the operation. More...
 
TopTools_ListOfShape myHistShapes
 Storer for the history shapes. More...
 
TopTools_MapOfShape myMapShape
 Cashed map of all arguments shapes. More...
 
Standard_Boolean myFillHistory
 Controls the history filling. More...
 
Handle< BRepTools_HistorymyHistory
 History tool. More...
 
- 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...
 
Handle< Message_ProgressIndicatormyProgressIndicator
 Enables/Disables the usage of OBB. More...
 
Standard_Boolean myUseOBB
 Enables/Disables the usage of OBB. More...
 

Additional Inherited Members

- Static Public 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 RemoveFeatures algorithm is intended for reconstruction of the shape by removal of the unwanted parts from it. These parts can be holes, protrusions, spikes, fillets etc. The shape itself is not modified, the new shape is built in the result.

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 faces which have to be removed. It does not matter how the faces 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. Before reconstructing the shape, the algorithm will sort all the given faces on the connected blocks (features).

The features will be removed from the shape one by one. It will allow removing all possible features even if there were problems with the removal of some of them.

The removed feature is filled by the extension of the faces adjacent to the feature. In general, the algorithm of removing of the single feature from the shape looks as follows:

If the removal is successful, the result is overwritten with the new shape and the next feature is treated. Otherwise, the warning will be given.

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.

History support allows tracking modification of the input shape in terms of Modified, IsDeleted and Generated. The history is available through the methods of the history tool BRepTools_History, which can be accessed here through the method History(). By default, the history is collected, but it is possible to disable it using the method SetToFillHistory(false);

Error/Warning reporting system - allows obtaining the extended overview of the Errors/Warnings occurred during the operation. As soon as any error appears the algorithm stops working. The warnings allow continuing the job, informing the user that something went wrong. The algorithm returns the following errors/warnings:

Parallel processing mode - allows running the algorithm in parallel mode obtaining the result faster.

The algorithm has certain limitations:

Note that for successful removal of the feature, the extended faces adjacent to the feature should cover the feature completely, otherwise the solids will not be rebuild.

Here is the example of usage of the algorithm:

TopoDS_Shape aSolid = ...; // Input shape to remove the features from
TopTools_ListOfShape aFaces = ...; // Faces to remove from the shape
Standard_Boolean bRunParallel = ...; // Parallel processing mode
Standard_Boolean isHistoryNeeded = ...; // History support
BOPAlgo_RemoveFeatures aRF; // Feature removal algorithm
aRF.SetShape(aSolid); // Set the shape
aRF.AddFacesToRemove(aFaces); // Add faces to remove
aRF.SetRunParallel(bRunParallel); // Define the processing mode (parallel or single)
aRF.SetToFillHistory(isHistoryNeeded); // Define whether to track the shapes modifications
aRF.Perform(); // Perform the operation
if (aRF.HasErrors()) // Check for the errors
{
// error treatment
return;
}
if (aRF.HasWarnings()) // Check for the warnings
{
// warnings treatment
}
const TopoDS_Shape& aResult = aRF.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.

When all possible features are removed, the shape is simplified by removing extra edges and vertices, created during operation, from the result shape.

Constructor & Destructor Documentation

◆ BOPAlgo_RemoveFeatures()

BOPAlgo_RemoveFeatures::BOPAlgo_RemoveFeatures ( )
inline

Empty constructor.

Member Function Documentation

◆ AddFacesToRemove()

void BOPAlgo_RemoveFeatures::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 BOPAlgo_RemoveFeatures::AddFaceToRemove ( const TopoDS_Shape theFace)
inline

Adds the face to remove from the input shape.

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

◆ CheckData()

virtual void BOPAlgo_RemoveFeatures::CheckData ( )
overrideprotectedvirtual

Checks the input data on validity for the algorithm:

  • The input shape must be either a SOLID, COMPSOLID or COMPOUND of Solids. If the input shape is not a solid, the method looks for the solids in <myInputShape> and uses only them. All other shapes are simply removed. If no solids were found, the Error of unsupported type is returned.

Reimplemented from BOPAlgo_Algo.

◆ Clear()

virtual void BOPAlgo_RemoveFeatures::Clear ( )
inlineoverridevirtual

Clears the contents of the algorithm from previous run, allowing reusing it for following removals.

Reimplemented from BOPAlgo_BuilderShape.

◆ FacesToRemove()

const TopTools_ListOfShape& BOPAlgo_RemoveFeatures::FacesToRemove ( ) const
inline

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

◆ InputShape()

const TopoDS_Shape& BOPAlgo_RemoveFeatures::InputShape ( ) const
inline

Returns the input shape.

◆ Perform()

virtual void BOPAlgo_RemoveFeatures::Perform ( )
overridevirtual

Performs the operation.

Implements BOPAlgo_Algo.

◆ PostTreat()

void BOPAlgo_RemoveFeatures::PostTreat ( )
protected

Post treatment - restore the type of the initial shape.

◆ PrepareFeatures()

void BOPAlgo_RemoveFeatures::PrepareFeatures ( )
protected

Prepares the faces to remove:

  • Gets only faces contained in the input solids;
  • Builds connected blocks of faces creating separate features to remove.

◆ RemoveFeature()

void BOPAlgo_RemoveFeatures::RemoveFeature ( const TopoDS_Shape theFeature,
const TopTools_IndexedMapOfShape theSolids,
const TopTools_MapOfShape theFeatureFacesMap,
const Standard_Boolean  theHasAdjacentFaces,
const TopTools_IndexedDataMapOfShapeListOfShape theAdjFaces,
const Handle< BRepTools_History > &  theAdjFacesHistory,
const Standard_Boolean  theSolidsHistoryNeeded 
)
protected

Remove the single feature from the shape.

Parameters
theFeature[in] The feature to remove;
theSolids[in] The solids to be reconstructed after feature removal;
theFeatureFacesMap[in] The map of feature faces;
theHasAdjacentFaces[in] Shows whether the adjacent faces have been found for the feature or not;
theAdjFaces[in] The reconstructed adjacent faces covering the feature;
theAdjFacesHistory[in] The history of the adjacent faces reconstruction;
theSolidsHistoryNeeded[in] Defines whether the history of solids modifications should be tracked or not.

◆ RemoveFeatures()

void BOPAlgo_RemoveFeatures::RemoveFeatures ( )
protected

Removes the features and fills the created gaps by extension of the adjacent faces. Processes each feature separately.

◆ SetShape()

void BOPAlgo_RemoveFeatures::SetShape ( const TopoDS_Shape theShape)
inline

Sets the shape for processing.

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

◆ SimplifyResult()

void BOPAlgo_RemoveFeatures::SimplifyResult ( )
protected

Simplifies the result by removing extra edges and vertices created during removal of the features.

◆ UpdateHistory()

void BOPAlgo_RemoveFeatures::UpdateHistory ( )
protected

Updates history with the removed features.

Field Documentation

◆ myFacesToRemove

TopTools_ListOfShape BOPAlgo_RemoveFeatures::myFacesToRemove
protected

Faces to remove.

◆ myFeatures

TopTools_ListOfShape BOPAlgo_RemoveFeatures::myFeatures
protected

List of not connected features to remove (each feature is a compound of faces)

◆ myInputShape

TopoDS_Shape BOPAlgo_RemoveFeatures::myInputShape
protected

Input shape.

◆ myInputsMap

TopTools_IndexedMapOfShape BOPAlgo_RemoveFeatures::myInputsMap
protected

Map of all sub-shapes of the input shape.


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