Open CASCADE Technology
7.4.0
|
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>
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_Shape & | InputShape () 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_ListOfShape & | FacesToRemove () 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_Shape & | Shape () const |
Returns the result of algorithm. More... | |
const TopTools_ListOfShape & | Modified (const TopoDS_Shape &theS) |
Returns the list of shapes Modified from the shape theS. More... | |
const TopTools_ListOfShape & | Generated (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_History > | History () |
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_History > | myHistory |
History tool. More... | |
Protected Attributes inherited from BOPAlgo_Options | |
Handle< NCollection_BaseAllocator > | myAllocator |
Enables/Disables the usage of OBB. More... | |
Handle< Message_Report > | myReport |
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_ProgressIndicator > | myProgressIndicator |
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... | |
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:
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.
|
inline |
Empty constructor.
|
inline |
Adds the faces to remove from the input shape.
theFaces | [in] The list of shapes to extract the faces for removal. |
|
inline |
Adds the face to remove from the input shape.
theFace | [in] The shape to extract the faces for removal. |
|
overrideprotectedvirtual |
Checks the input data on validity for the algorithm:
Reimplemented from BOPAlgo_Algo.
|
inlineoverridevirtual |
Clears the contents of the algorithm from previous run, allowing reusing it for following removals.
Reimplemented from BOPAlgo_BuilderShape.
|
inline |
Returns the list of faces which have been requested for removal from the input shape.
|
inline |
Returns the input shape.
|
overridevirtual |
Performs the operation.
Implements BOPAlgo_Algo.
|
protected |
Post treatment - restore the type of the initial shape.
|
protected |
Prepares the faces to remove:
|
protected |
Remove the single feature from the shape.
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. |
|
protected |
Removes the features and fills the created gaps by extension of the adjacent faces. Processes each feature separately.
|
inline |
Sets the shape for processing.
theShape | [in] The shape to remove the faces from. It should either be the SOLID, COMPSOLID or COMPOUND of Solids. |
|
protected |
Simplifies the result by removing extra edges and vertices created during removal of the features.
|
protected |
Updates history with the removed features.
|
protected |
Faces to remove.
|
protected |
List of not connected features to remove (each feature is a compound of faces)
|
protected |
Input shape.
|
protected |
Map of all sub-shapes of the input shape.