Open CASCADE Technology  7.2.0
Public Member Functions | Protected Member Functions | Protected Attributes
BOPAlgo_CellsBuilder Class Reference

The algorithm is based on the General Fuse algorithm (GFA). The result of GFA is all split parts of the Arguments.
More...

#include <BOPAlgo_CellsBuilder.hxx>

Inheritance diagram for BOPAlgo_CellsBuilder:
Inheritance graph
[legend]

Public Member Functions

 BOPAlgo_CellsBuilder ()
 
 BOPAlgo_CellsBuilder (const Handle< NCollection_BaseAllocator > &theAllocator)
 
virtual ~BOPAlgo_CellsBuilder ()
 
virtual void Clear () override
 Redefined method Clear - clears the contents. More...
 
void AddToResult (const BOPCol_ListOfShape &theLSToTake, const BOPCol_ListOfShape &theLSToAvoid, const Standard_Integer theMaterial=0, const Standard_Boolean theUpdate=Standard_False)
 Adding the parts to result.
The parts are defined by two lists of shapes:
<theLSToTake> defines the arguments which parts should be taken into result;
<theLSToAvoid> defines the arguments which parts should not be taken into result;
To be taken into result the part must be IN for all shapes from the list <theLSToTake> and must be OUT of all shapes from the list <theLSToAvoid>.
More...
 
void AddAllToResult (const Standard_Integer theMaterial=0, const Standard_Boolean theUpdate=Standard_False)
 Add all split parts to result.
<theMaterial> defines the removal of internal boundaries;
<theUpdate> parameter defines whether to remove boundaries now or not. More...
 
void RemoveFromResult (const BOPCol_ListOfShape &theLSToTake, const BOPCol_ListOfShape &theLSToAvoid)
 Removing the parts from result.
The parts are defined by two lists of shapes:
<theLSToTake> defines the arguments which parts should be removed from result;
<theLSToAvoid> defines the arguments which parts should not be removed from result.
To be removed from the result the part must be IN for all shapes from the list <theLSToTake> and must be OUT of all shapes from the list <theLSToAvoid>. More...
 
void RemoveAllFromResult ()
 Remove all parts from result. More...
 
void RemoveInternalBoundaries ()
 Removes internal boundaries between cells with the same material.
If the result contains the cells with same material but of different dimension the removal of internal boundaries between these cells will not be performed.
In case of some errors during the removal the method will set the appropriate warning status - use GetReport() to access them. More...
 
const TopoDS_ShapeGetAllParts () const
 Get all split parts. More...
 
void MakeContainers ()
 Makes the Containers of proper type from the parts added to result. More...
 
virtual const TopTools_ListOfShapeModified (const TopoDS_Shape &theS) override
 Returns the list of shapes generated from the shape theS. More...
 
virtual Standard_Boolean IsDeleted (const TopoDS_Shape &theS) override
 Returns true if the shape theS has been deleted. More...
 
- Public Member Functions inherited from BOPAlgo_Builder
 BOPAlgo_Builder ()
 
virtual ~BOPAlgo_Builder ()
 
 BOPAlgo_Builder (const BOPCol_BaseAllocator &theAllocator)
 
BOPAlgo_PPaveFiller PPaveFiller ()
 
BOPDS_PDS PDS ()
 
virtual void AddArgument (const TopoDS_Shape &theShape)
 
virtual void SetArguments (const BOPCol_ListOfShape &theLS)
 
const BOPCol_ListOfShapeArguments () const
 
virtual void Perform () override
 
virtual void PerformWithFiller (const BOPAlgo_PaveFiller &theFiller)
 
virtual const TopTools_ListOfShapeGenerated (const TopoDS_Shape &theS) override
 Returns the list of shapes generated from the shape theS. More...
 
const BOPCol_DataMapOfShapeListOfShapeImages () const
 
Standard_Boolean IsInterferred (const TopoDS_Shape &theS) const
 
const BOPCol_DataMapOfShapeListOfShapeOrigins () const
 Returns myOrigins. More...
 
const BOPCol_DataMapOfShapeShapeShapesSD () const
 Returns myShapesSD. More...
 
const BOPCol_DataMapOfShapeListOfShapeSplits () const
 Returns mySplits. More...
 
void SetNonDestructive (const Standard_Boolean theFlag)
 Sets the flag that defines the mode of treatment. In non-destructive mode the argument shapes are not modified. Instead a copy of a sub-shape is created in the result if it is needed to be updated. This flag is taken into account if internal PaveFiller is used only. In the case of calling PerformWithFiller the corresponding flag of that PaveFiller is in force. More...
 
Standard_Boolean NonDestructive () const
 Returns the flag that defines the mode of treatment. In non-destructive mode the argument shapes are not modified. Instead a copy of a sub-shape is created in the result if it is needed to be updated. More...
 
void SetGlue (const BOPAlgo_GlueEnum theGlue)
 Sets the glue option for the algorithm. More...
 
BOPAlgo_GlueEnum Glue () const
 Returns the glue option of the algorithm. More...
 
- Public Member Functions inherited from BOPAlgo_BuilderShape
const TopoDS_ShapeShape () const
 Returns the result of algorithm. More...
 
Standard_Boolean HasDeleted () const
 Returns true if the at least one shape(or subshape) of arguments has been deleted. More...
 
Standard_Boolean HasGenerated () const
 Returns true if the at least one shape(or subshape) of arguments has generated shapes. More...
 
Standard_Boolean HasModified () const
 Returns true if the at least one shape(or subshape) of arguments has modified shapes. More...
 
const BOPCol_IndexedDataMapOfShapeListOfShapeImagesResult () const
 
- Public Member Functions inherited from BOPAlgo_Options
 BOPAlgo_Options ()
 Empty constructor. More...
 
 BOPAlgo_Options (const BOPCol_BaseAllocator &theAllocator)
 Constructor with allocator. More...
 
virtual ~BOPAlgo_Options ()
 Destructor. More...
 
const BOPCol_BaseAllocatorAllocator () 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...
 

Protected Member Functions

virtual void Prepare () override
 Redefined method Prepare - no need to prepare history information on the default result as it is empty compound. More...
 
virtual void PerformInternal1 (const BOPAlgo_PaveFiller &thePF) override
 Redefined method PerformInternal1 - makes all split parts, nullifies the result <myShape>, and index all parts. More...
 
void IndexParts ()
 Indexes the parts for quick access to the arguments. More...
 
void FindParts (const BOPCol_ListOfShape &theLSToTake, const BOPCol_ListOfShape &theLSToAvoid, BOPCol_ListOfShape &theParts)
 Looking for the parts defined by two lists. More...
 
Standard_Boolean RemoveInternals (const BOPCol_ListOfShape &theLS, BOPCol_ListOfShape &theLSNew)
 Removes internal boundaries between cells with the same material.
Returns TRUE if any internal boundaries have been removed. More...
 
- Protected Member Functions inherited from BOPAlgo_Builder
virtual void PrepareHistory () override
 Prepare information for history support. More...
 
virtual void PerformInternal (const BOPAlgo_PaveFiller &thePF)
 
virtual void CheckData () override
 Checks input data. More...
 
void CheckFiller ()
 Checks if the intersection algorithm has Errors/Warnings. More...
 
void FillImagesVertices ()
 
void FillImagesEdges ()
 
virtual void BuildResult (const TopAbs_ShapeEnum theType)
 
void FillImagesContainers (const TopAbs_ShapeEnum theType)
 
void FillImagesCompounds ()
 
void FillImagesContainer (const TopoDS_Shape &theS, const TopAbs_ShapeEnum theType)
 
void FillImagesCompound (const TopoDS_Shape &theS, BOPCol_MapOfShape &theMF)
 
void FillImagesFaces ()
 
virtual void BuildSplitFaces ()
 
void FillSameDomainFaces ()
 
void FillImagesFaces1 ()
 
void FillImagesSolids ()
 
void BuildDraftSolid (const TopoDS_Shape &theSolid, TopoDS_Shape &theDraftSolid, BOPCol_ListOfShape &theLIF)
 
virtual void FillIn3DParts (BOPCol_DataMapOfShapeListOfShape &theInParts, BOPCol_DataMapOfShapeShape &theDraftSolids, const BOPCol_BaseAllocator &theAllocator)
 
void BuildSplitSolids (BOPCol_DataMapOfShapeListOfShape &theInParts, BOPCol_DataMapOfShapeShape &theDraftSolids, const BOPCol_BaseAllocator &theAllocator)
 
void FillInternalShapes ()
 
virtual void PostTreat ()
 
- Protected Member Functions inherited from BOPAlgo_BuilderShape
 BOPAlgo_BuilderShape ()
 
virtual ~BOPAlgo_BuilderShape ()
 
 BOPAlgo_BuilderShape (const BOPCol_BaseAllocator &theAllocator)
 
- Protected Member Functions inherited from BOPAlgo_Algo
 BOPAlgo_Algo ()
 Default constructor. More...
 
virtual ~BOPAlgo_Algo ()
 
 BOPAlgo_Algo (const BOPCol_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

TopoDS_Shape myAllParts
 
BOPCol_IndexedDataMapOfShapeListOfShape myIndex
 
BOPCol_DataMapOfIntegerListOfShape myMaterials
 
BOPCol_DataMapOfShapeInteger myShapeMaterial
 
BOPCol_DataMapOfShapeShape myMapModified
 
- Protected Attributes inherited from BOPAlgo_Builder
BOPCol_ListOfShape myArguments
 
BOPCol_MapOfShape myMapFence
 
BOPAlgo_PPaveFiller myPaveFiller
 
BOPDS_PDS myDS
 
Handle< IntTools_ContextmyContext
 
Standard_Integer myEntryPoint
 
BOPCol_DataMapOfShapeListOfShape myImages
 
BOPCol_DataMapOfShapeShape myShapesSD
 
BOPCol_DataMapOfShapeListOfShape mySplits
 
BOPCol_DataMapOfShapeListOfShape myOrigins
 
Standard_Boolean myNonDestructive
 
BOPAlgo_GlueEnum myGlue
 
- Protected Attributes inherited from BOPAlgo_BuilderShape
TopoDS_Shape myShape
 
TopTools_ListOfShape myHistShapes
 
BOPCol_MapOfShape myMapShape
 
Standard_Boolean myHasDeleted
 
Standard_Boolean myHasGenerated
 
Standard_Boolean myHasModified
 
BOPCol_IndexedDataMapOfShapeListOfShape myImagesResult
 
Standard_Boolean myFlagHistory
 
- Protected Attributes inherited from BOPAlgo_Options
BOPCol_BaseAllocator myAllocator
 Set the Progress Indicator object. More...
 
Handle< Message_ReportmyReport
 Set the Progress Indicator object. More...
 
Standard_Boolean myRunParallel
 Set the Progress Indicator object. More...
 
Standard_Real myFuzzyValue
 Set the Progress Indicator object. More...
 
Handle< Message_ProgressIndicatormyProgressIndicator
 Set the Progress Indicator object. 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 algorithm is based on the General Fuse algorithm (GFA). The result of GFA is all split parts of the Arguments.

The purpose of this algorithm is to provide the result with the content of:

  1. Cells (parts) defined by the user;
  2. Internal boundaries defined by the user.

In other words the algorithm should provide the possibility for the user to add or remove any part to (from) result and remove any internal boundaries between parts.

Requirements for the Data:
All the requirements of GFA for the DATA are inherited in this algorithm - The arguments could be of any type (dimension) and should be valid in terms of BRepCheck_Analyzer and BOPAlgo_ArgumentAnalyzer.

Results:
The result of the algorithm is compound containing selected parts of the basic types (VERTEX, EDGE, FACE or SOLID). The default result is empty compound. It is possible to add any split part to the result by using the methods AddToRessult() and AddAllToResult(). It is also possible to remove any part from the result by using methods RemoveFromResult() and RemoveAllFromResult(). The method RemoveAllFromResult() is also suitable for clearing the result.

To remove Internal boundaries it is necessary to set the same material to the parts between which the boundaries should be removed and call the method RemoveInternalBoundaries(). The material should not be equal to 0, as this is default material value. The boundaries between parts with this value will not be removed. One part cannot be added with the different materials. It is also possible to remove the boundaries during combining the result. To do this it is necessary to set the material for parts (not equal to 0) and set the flag bUpdate to TRUE. For the arguments of the types FACE or EDGE it is recommended to remove the boundaries in the end when the result is completely built. It will help to avoid self-intersections in the result.
Note, that if the result contains the parts with same material but of different dimension the boundaries between such parts will not be removed. Currently, the removal of the internal boundaries between multi-dimensional shapes is not supported.

It is possible to create typed Containers from the parts added to result by using method MakeContainers(). The type of the containers will depend on the type of the arguments: WIRES for EEDGE, SHELLS for FACES and COMPSOLIDS for SOLIDS. The result will be compound containing containers. Adding of the parts to such result will not update containers. The result compound will contain the containers and new added parts (of basic type). Removing of the parts from such result may affect some containers if the parts that should be removed is in container. In this case this container will be rebuilt without that part.

History:
The algorithm supports history information for basic types of the shapes - VERTEX, EDGE, FACE. This information available through the methods IsDeleted() and Modified().
In DRAW Test Harness it is available through the same commands as for Boolean Operations (bmodified, bgenerated and bisdeleted).
There could be Generated shapes only after removing of the internal boundaries between faces and edges, i.e. after using ShapeUpgrade_UnifySameDomain tool.

The algorithm can return the following Error Statuses:

The algorithm can set the following Warning Statuses:

The Warning status can be checked with HasWarnings() method or printed with the DumpWarnings() method. If warnings are recorded, the result may be not as expected.

Examples:

  1. API
    BOPAlgo_CellsBuilder aCBuilder;
    BOPCol_ListOfShape aLS = ...; // arguments
    /* parallel or single mode (the default value is FALSE)*/
    Standard_Boolean bRunParallel = Standard_False;
    /* fuzzy option (default value is 0)*/
    Standard_Real aTol = 0.0;
    //
    aCBuilder.SetArguments(aLS);
    aCBuilder.SetRunParallel(bRunParallel);
    aCBuilder.SetFuzzyValue(aTol);
    //
    aCBuilder.Perform();
    if (aCBuilder.HasErrors()) { // check error status
    return;
    }
    /* empty compound, as nothing has been added yet */
    const TopoDS_Shape& aRes = aCBuilder.Shape();
    /* all split parts */
    const TopoDS_Shape& aRes = aCBuilder.GetAllParts();
    //
    BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
    BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
    //
    /* defines the material common for the cells, i.e. the boundaries between cells with the same material will be removed.
    By default it is set to 0. Thus, to remove some boundary the value of this variable should not be equal to 0 */
    Standard_Integer iMaterial = ...;
    /* defines whether to update the result right now or not */
    Standard_Boolean bUpdate = ...;
    // adding to result
    aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate);
    aR = aCBuilder.Shape(); // the result
    // removing of the boundaries (should be called only if bUpdate is false)
    aCBuilder.RemoveInternalBoundaries();
    //
    // removing from result
    aCBuilder.AddAllToResult();
    aCBuilder.RemoveFromResult(aLSToTake, aLSToAvoid);
    aR = aCBuilder.Shape(); // the result

  2. DRAW Test Harness
    psphere s1 15
    psphere s2 15
    psphere s3 15
    ttranslate s1 0 0 10
    ttranslate s2 20 0 10
    ttranslate s3 10 0 0
    # adding arguments
    bclearobjects; bcleartools
    baddobjects s1 s2 s3
    # intersection
    bfillds
    # rx will contain all split parts
    bcbuild rx
    # add to result the part that is common for all three spheres
    bcadd res s1 1 s2 1 s3 1 -m 1
    # add to result the part that is common only for first and third spheres
    bcadd res s1 1 s2 0 s3 1 -m 1
    # remove internal boundaries
    bcremoveint res

Constructor & Destructor Documentation

◆ BOPAlgo_CellsBuilder() [1/2]

BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder ( )

◆ BOPAlgo_CellsBuilder() [2/2]

BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder ( const Handle< NCollection_BaseAllocator > &  theAllocator)

◆ ~BOPAlgo_CellsBuilder()

virtual BOPAlgo_CellsBuilder::~BOPAlgo_CellsBuilder ( )
virtual

Member Function Documentation

◆ AddAllToResult()

void BOPAlgo_CellsBuilder::AddAllToResult ( const Standard_Integer  theMaterial = 0,
const Standard_Boolean  theUpdate = Standard_False 
)

Add all split parts to result.
<theMaterial> defines the removal of internal boundaries;
<theUpdate> parameter defines whether to remove boundaries now or not.

◆ AddToResult()

void BOPAlgo_CellsBuilder::AddToResult ( const BOPCol_ListOfShape theLSToTake,
const BOPCol_ListOfShape theLSToAvoid,
const Standard_Integer  theMaterial = 0,
const Standard_Boolean  theUpdate = Standard_False 
)

Adding the parts to result.
The parts are defined by two lists of shapes:
<theLSToTake> defines the arguments which parts should be taken into result;
<theLSToAvoid> defines the arguments which parts should not be taken into result;
To be taken into result the part must be IN for all shapes from the list <theLSToTake> and must be OUT of all shapes from the list <theLSToAvoid>.

To remove internal boundaries between any cells in the result <theMaterial> variable should be used. The boundaries between cells with the same material will be removed. Default value is 0.
Thus, to remove any boundary the value of this variable should not be equal to 0.
<theUpdate> parameter defines whether to remove boundaries now or not.

◆ Clear()

virtual void BOPAlgo_CellsBuilder::Clear ( )
overridevirtual

Redefined method Clear - clears the contents.

Reimplemented from BOPAlgo_Builder.

◆ FindParts()

void BOPAlgo_CellsBuilder::FindParts ( const BOPCol_ListOfShape theLSToTake,
const BOPCol_ListOfShape theLSToAvoid,
BOPCol_ListOfShape theParts 
)
protected

Looking for the parts defined by two lists.

◆ GetAllParts()

const TopoDS_Shape& BOPAlgo_CellsBuilder::GetAllParts ( ) const

Get all split parts.

◆ IndexParts()

void BOPAlgo_CellsBuilder::IndexParts ( )
protected

Indexes the parts for quick access to the arguments.

◆ IsDeleted()

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

Returns true if the shape theS has been deleted.

Reimplemented from BOPAlgo_Builder.

◆ MakeContainers()

void BOPAlgo_CellsBuilder::MakeContainers ( )

Makes the Containers of proper type from the parts added to result.

◆ Modified()

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

Returns the list of shapes generated from the shape theS.

Reimplemented from BOPAlgo_Builder.

◆ PerformInternal1()

virtual void BOPAlgo_CellsBuilder::PerformInternal1 ( const BOPAlgo_PaveFiller thePF)
overrideprotectedvirtual

Redefined method PerformInternal1 - makes all split parts, nullifies the result <myShape>, and index all parts.

Reimplemented from BOPAlgo_Builder.

◆ Prepare()

virtual void BOPAlgo_CellsBuilder::Prepare ( )
overrideprotectedvirtual

Redefined method Prepare - no need to prepare history information on the default result as it is empty compound.

Reimplemented from BOPAlgo_Builder.

◆ RemoveAllFromResult()

void BOPAlgo_CellsBuilder::RemoveAllFromResult ( )

Remove all parts from result.

◆ RemoveFromResult()

void BOPAlgo_CellsBuilder::RemoveFromResult ( const BOPCol_ListOfShape theLSToTake,
const BOPCol_ListOfShape theLSToAvoid 
)

Removing the parts from result.
The parts are defined by two lists of shapes:
<theLSToTake> defines the arguments which parts should be removed from result;
<theLSToAvoid> defines the arguments which parts should not be removed from result.
To be removed from the result the part must be IN for all shapes from the list <theLSToTake> and must be OUT of all shapes from the list <theLSToAvoid>.

◆ RemoveInternalBoundaries()

void BOPAlgo_CellsBuilder::RemoveInternalBoundaries ( )

Removes internal boundaries between cells with the same material.
If the result contains the cells with same material but of different dimension the removal of internal boundaries between these cells will not be performed.
In case of some errors during the removal the method will set the appropriate warning status - use GetReport() to access them.

◆ RemoveInternals()

Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals ( const BOPCol_ListOfShape theLS,
BOPCol_ListOfShape theLSNew 
)
protected

Removes internal boundaries between cells with the same material.
Returns TRUE if any internal boundaries have been removed.

Field Documentation

◆ myAllParts

TopoDS_Shape BOPAlgo_CellsBuilder::myAllParts
protected

◆ myIndex

BOPCol_IndexedDataMapOfShapeListOfShape BOPAlgo_CellsBuilder::myIndex
protected

◆ myMapModified

BOPCol_DataMapOfShapeShape BOPAlgo_CellsBuilder::myMapModified
protected

◆ myMaterials

BOPCol_DataMapOfIntegerListOfShape BOPAlgo_CellsBuilder::myMaterials
protected

◆ myShapeMaterial

BOPCol_DataMapOfShapeInteger BOPAlgo_CellsBuilder::myShapeMaterial
protected

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