OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    BOPAlgo_BuilderSolid Class Reference

    Solid Builder is the algorithm for building solids from set of faces. The given faces should be non-intersecting, i.e. all coinciding parts of the faces should be shared among them. More...

    #include <BOPAlgo_BuilderSolid.hxx>

    Inheritance diagram for BOPAlgo_BuilderSolid:

    Public Member Functions

    Constructors

    Empty constructor

     BOPAlgo_BuilderSolid ()
     Constructor with allocator.
     ~BOPAlgo_BuilderSolid () override
     Constructor with allocator.
     BOPAlgo_BuilderSolid (const occ::handle< NCollection_BaseAllocator > &theAllocator)
     Constructor with allocator.
    Performing the operation

    Performs the construction of the solids from the given faces

    void Perform (const Message_ProgressRange &theRange=Message_ProgressRange()) override
     The main method to implement the operation Providing the range allows to enable Progress indicator User break functionalities.
    Getting the bounding boxes of the created solids

    For classification purposes the algorithm builds the bounding boxes for all created solids. This method returns the data map of solid - box pairs.

    const NCollection_DataMap< TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher > & GetBoxesMap () const
    Public Member Functions inherited from BOPAlgo_BuilderArea
    void SetContext (const occ::handle< IntTools_Context > &theContext)
     Sets the context for the algorithms.
    const NCollection_List< TopoDS_Shape > & Shapes () const
     Returns the input shapes.
    void SetShapes (const NCollection_List< TopoDS_Shape > &theLS)
     Sets the shapes for building areas.
    const NCollection_List< TopoDS_Shape > & Loops () const
     Returns the found loops.
    const NCollection_List< TopoDS_Shape > & Areas () const
     Returns the found areas.
    void SetAvoidInternalShapes (const bool theAvoidInternal)
     Defines the preventing of addition of internal parts into result. The default value is FALSE, i.e. the internal parts are added into result.
    bool IsAvoidInternalShapes () const
     Returns the AvoidInternalShapes flag.
    Public Member Functions inherited from BOPAlgo_Options
     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.
    virtual void Clear ()
     Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.
    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 methods performing the operation

    Collect the faces:

    • with INTERNAL orientation;
    • that are alone but given twice with different orientation. These faces will be put into the map myShapesToAvoid and will be avoided in shells construction, but will be classified later on.
    void PerformShapesToAvoid (const Message_ProgressRange &theRange) override
     Build all possible closed shells from the given faces. The method fills the following maps:
    void PerformLoops (const Message_ProgressRange &theRange) override
     Build all possible closed shells from the given faces. The method fills the following maps:
    void PerformAreas (const Message_ProgressRange &theRange) override
     Classifies the created shells on the Holes and Growths. Creates the solids from the Growths shells. Puts the Hole shells into the closest Growths solids.
    void PerformInternalShapes (const Message_ProgressRange &theRange) override
     Classifies the unused faces relatively the created solids. Puts the classified faces into the closest solids as internal shells. Warns the user about unclassified faces if any.

    Additional Inherited Members

    static bool GetParallelMode ()
     Gets the global parallel mode.
    static void SetParallelMode (const bool theNewMode)
     Sets the global parallel mode.
    Protected Member Functions inherited from BOPAlgo_BuilderArea
     BOPAlgo_BuilderArea ()
     ~BOPAlgo_BuilderArea () override
     BOPAlgo_BuilderArea (const occ::handle< NCollection_BaseAllocator > &theAllocator)
    Protected Member Functions inherited from BOPAlgo_Algo
     BOPAlgo_Algo ()
     Default constructor.
     ~BOPAlgo_Algo () override
     BOPAlgo_Algo (const occ::handle< NCollection_BaseAllocator > &theAllocator)
    virtual void CheckData ()
     Checks input data.
    virtual void CheckResult ()
     Checks the obtained result.
    void analyzeProgress (const double theWhole, BOPAlgo_PISteps &theSteps) const
     Fills the values for constant operations - the operations having constant relative running time.
    virtual void fillPIConstants (const double theWhole, BOPAlgo_PISteps &theSteps) const
     Fills the values for constant operations - the operations having constant relative running time.
    virtual void fillPISteps (BOPAlgo_PISteps &theSteps) const
     Fills the values for the operations dependent on the inputs. Filled values may not be normalized to represent percentage of total running time. The values should just correlate to each other. E.g. if progress depends on the number of input shapes, the values may look like this: step1 = number_of_input_vertices; step2 = 2 * number_of_input_edges; step3 = 10 * number_of_input_faces. Normalization of these values will be done automatically in analyzeProgress() method.
    bool UserBreak (const Message_ProgressScope &thePS)
     Adds error to the report if the break signal was caught. Returns true in this case, false otherwise.
    Protected Attributes inherited from BOPAlgo_BuilderArea
    occ::handle< IntTools_ContextmyContext
    NCollection_List< TopoDS_ShapemyShapes
    NCollection_List< TopoDS_ShapemyLoops
    NCollection_List< TopoDS_ShapemyLoopsInternal
    NCollection_List< TopoDS_ShapemyAreas
    NCollection_IndexedMap< TopoDS_ShapemyShapesToAvoid
    bool myAvoidInternalShapes
    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.

    Detailed Description

    Solid Builder is the algorithm for building solids from set of faces. The given faces should be non-intersecting, i.e. all coinciding parts of the faces should be shared among them.

    The algorithm performs the following steps to build the solids:

    1. Find:
      • faces orientated INTERNAL;
      • alone faces given twice with different orientation;
    2. Build all possible closed shells from the rest of the faces (BOPAlgo_ShellSplitter is used for that);
    3. Classify the obtained shells on the Holes and Growths;
    4. Build solids from the Growth shells, put Hole shells into closest Growth solids;
    5. Classify all unused faces relatively created solids and put them as internal shells into the closest solids;
    6. Find all unclassified faces, i.e. faces outside of all created solids, make internal shells from them and put these shells into a warning.

    It is possible to avoid all internal shells in the resulting solids. For that it is necessary to use the method SetAvoidInternalShapes(true) of the base class. In this case the steps 5 and 6 will not be performed at all.

    The algorithm may return the following warnings:

    • BOPAlgo_AlertShellSplitterFailed in case the ShellSplitter algorithm has failed;
    • BOPAlgo_AlertSolidBuilderUnusedFaces in case there are some faces outside of created solids left.

    Example of usage of the algorithm:

    const NCollection_List<TopoDS_Shape>& aFaces = ...; // Faces to build the solids
    bool isAvoidInternals = ...; // Flag which defines whether to create the
    internal shells or not BOPAlgo_BuilderSolid aBS; // Solid Builder tool
    aBS.SetShapes(aFaces); // Set the faces
    aBS.SetAvoidInternalShapes(isAvoidInternals); // Set the AvoidInternalShapesFlag
    aBS.Perform(); // Perform the operation
    if (!aBS.IsDone()) // Check for the errors
    {
    // error treatment
    Standard_SStream aSStream;
    aBS.DumpErrors(aSStream);
    return;
    }
    if (aBS.HasWarnings()) // Check for the warnings
    {
    // warnings treatment
    Standard_SStream aSStream;
    aBS.DumpWarnings(aSStream);
    }
    const NCollection_List<TopoDS_Shape>& aSolids = aBS.Areas(); // Obtaining the result solids
    std::stringstream Standard_SStream
    Defines Standard_SStream as typedef to C++ string stream.
    Definition Standard_SStream.hxx:21
    BOPAlgo_BuilderSolid()
    Constructor with allocator.
    Definition NCollection_List.hxx:33

    Constructor & Destructor Documentation

    ◆ BOPAlgo_BuilderSolid() [1/2]

    BOPAlgo_BuilderSolid::BOPAlgo_BuilderSolid ( )

    Constructor with allocator.

    ◆ ~BOPAlgo_BuilderSolid()

    BOPAlgo_BuilderSolid::~BOPAlgo_BuilderSolid ( )
    override

    Constructor with allocator.

    ◆ BOPAlgo_BuilderSolid() [2/2]

    BOPAlgo_BuilderSolid::BOPAlgo_BuilderSolid ( const occ::handle< NCollection_BaseAllocator > & theAllocator)

    Constructor with allocator.

    Member Function Documentation

    ◆ GetBoxesMap()

    const NCollection_DataMap< TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher > & BOPAlgo_BuilderSolid::GetBoxesMap ( ) const
    inline

    ◆ Perform()

    void BOPAlgo_BuilderSolid::Perform ( const Message_ProgressRange & theRange = Message_ProgressRange())
    overridevirtual

    The main method to implement the operation Providing the range allows to enable Progress indicator User break functionalities.

    Implements BOPAlgo_Algo.

    ◆ PerformAreas()

    void BOPAlgo_BuilderSolid::PerformAreas ( const Message_ProgressRange & theRange)
    overrideprotectedvirtual

    Classifies the created shells on the Holes and Growths. Creates the solids from the Growths shells. Puts the Hole shells into the closest Growths solids.

    Implements BOPAlgo_BuilderArea.

    ◆ PerformInternalShapes()

    void BOPAlgo_BuilderSolid::PerformInternalShapes ( const Message_ProgressRange & theRange)
    overrideprotectedvirtual

    Classifies the unused faces relatively the created solids. Puts the classified faces into the closest solids as internal shells. Warns the user about unclassified faces if any.

    Implements BOPAlgo_BuilderArea.

    ◆ PerformLoops()

    void BOPAlgo_BuilderSolid::PerformLoops ( const Message_ProgressRange & theRange)
    overrideprotectedvirtual

    Build all possible closed shells from the given faces. The method fills the following maps:

    • myLoops - Created closed shells;
    • myLoopsInternal - The shells created from unused faces.

    Implements BOPAlgo_BuilderArea.

    ◆ PerformShapesToAvoid()

    void BOPAlgo_BuilderSolid::PerformShapesToAvoid ( const Message_ProgressRange & theRange)
    overrideprotectedvirtual

    Build all possible closed shells from the given faces. The method fills the following maps:

    • myLoops - Created closed shells;
    • myLoopsInternal - The shells created from unused faces.

    Implements BOPAlgo_BuilderArea.


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