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_MakeConnected Class Reference

    BOPAlgo_MakeConnected is the algorithm for making the touching shapes connected or glued, i.e. for making the coinciding geometries be topologically shared among the shapes. More...

    #include <BOPAlgo_MakeConnected.hxx>

    Inheritance diagram for BOPAlgo_MakeConnected:

    Public Member Functions

    Constructor

    Empty constructor

     BOPAlgo_MakeConnected ()=default
    Setters for the shapes to make connected

    Sets the shape for making them connected.

    Parameters
    [in]theArgsThe arguments for the operation.
    void SetArguments (const NCollection_List< TopoDS_Shape > &theArgs)
     Adds the shape to the arguments.
    void AddArgument (const TopoDS_Shape &theS)
     Adds the shape to the arguments.
    const NCollection_List< TopoDS_Shape > & Arguments () const
     Returns the list of arguments of the operation.
    Performing the operations

    Performs the operation, i.e. makes the input shapes connected.

    void Perform ()
    Shape periodicity & repetition

    Makes the connected shape periodic. Repeated calls of this method overwrite the previous calls working with the basis connected shape.

    Parameters
    [in]theParamsPeriodic options.
    void MakePeriodic (const BOPAlgo_MakePeriodic::PeriodicityParams &theParams)
     Performs repetition of the periodic shape in specified direction required number of times.
    void RepeatShape (const int theDirectionID, const int theTimes)
     Performs repetition of the periodic shape in specified direction required number of times.
    void ClearRepetitions ()
     Clears the repetitions performed on the periodic shape, keeping the shape periodic.
    const BOPAlgo_MakePeriodicPeriodicityTool () const
     Returns the periodicity tool.
    Material transitions

    Returns the original shapes which images contain the the given shape with FORWARD orientation.

    Parameters
    [in]theSThe shape for which the materials are necessary.
    const NCollection_List< TopoDS_Shape > & MaterialsOnPositiveSide (const TopoDS_Shape &theS)
     Returns the original shapes which images contain the the given shape with REVERSED orientation.
    const NCollection_List< TopoDS_Shape > & MaterialsOnNegativeSide (const TopoDS_Shape &theS)
     Returns the original shapes which images contain the the given shape with REVERSED orientation.
    History methods

    Returns the history of operations

    const occ::handle< BRepTools_History > & History () const
     Returns the list of shapes modified from the given shape.
    const NCollection_List< TopoDS_Shape > & GetModified (const TopoDS_Shape &theS)
     Returns the list of shapes modified from the given shape.
    const NCollection_List< TopoDS_Shape > & GetOrigins (const TopoDS_Shape &theS)
     Returns the list of original shapes from which the current shape has been created.
    Getting the result shapes

    Returns the resulting connected shape

    const TopoDS_ShapeShape () const
     Returns the resulting periodic & repeated shape.
    const TopoDS_ShapePeriodicShape () const
     Returns the resulting periodic & repeated shape.
    Clearing the contents of the algorithm from previous runs

    Clears the contents of the algorithm.

    void Clear () override
     Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.
    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.
    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
    NCollection_List< TopoDS_ShapemyArguments
     Input shapes for making them connected.
    NCollection_IndexedMap< TopoDS_Shape, TopTools_ShapeMapHashermyAllInputsMap
     Map of all BRep sub-elements of the input shapes.
    BOPAlgo_MakePeriodic myPeriodicityMaker
     Tool for making the shape periodic.
    NCollection_DataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape > > myMaterials
     Map of the materials associations for the border elements.
    NCollection_DataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHashermyOrigins
     Map of origins (allows tracking the shape's ancestors).
    occ::handle< BRepTools_HistorymyGlueHistory
     Gluing History.
    occ::handle< BRepTools_HistorymyHistory
     Final History of shapes modifications (including making the shape periodic and repetitions).
    TopoDS_Shape myGlued
     The resulting connected (glued) shape.
    TopoDS_Shape myShape
     The resulting shape.
    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.

    Protected methods performing the operation

    Checks the validity of input data.

    void CheckData ()
     Makes the argument shapes connected (or glued).
    void MakeConnected ()
     Makes the argument shapes connected (or glued).
    void AssociateMaterials ()
     Associates the materials transitions for the border elements:
    void FillOrigins ()
     Fills the map of origins.
    void Update ()
     Updates the history, material associations, origins map after periodicity operations.

    Additional Inherited Members

    static bool GetParallelMode ()
     Gets the global parallel mode.
    static void SetParallelMode (const bool theNewMode)
     Sets the global parallel mode.
    bool UserBreak (const Message_ProgressScope &thePS)
     Adds error to the report if the break signal was caught. Returns true in this case, false otherwise.

    Detailed Description

    BOPAlgo_MakeConnected is the algorithm for making the touching shapes connected or glued, i.e. for making the coinciding geometries be topologically shared among the shapes.

    The input shapes should be of the same dimension, otherwise the gluing will not make any sense.

    After the shapes are made connected, the border elements of input shapes are associated with the shapes to which they belong. At that, the orientation of the border element in the shape is taken into account. The associations are made for the following types:

    • For input SOLIDS, the resulting FACES are associated with the input solids;
    • For input FACES, the resulting EDGES are associated with the input faces;
    • For input EDGES, the resulting VERTICES are associated with the input edges.

    In frames of this algorithm the input shapes are called materials, and the association process is called the material association. The material association allows finding the coinciding elements for the opposite input shapes. These elements will be associated to at least two materials.

    After making the shapes connected, it is possible to make the connected shape periodic using the BOPAlgo_MakePeriodic tool. After making the shape periodic, the material associations will be updated to correspond to the actual state of the result shape. Repetition of the periodic shape is also possible here. Material associations are not going to be lost.

    The algorithm supports history of shapes modification, thus it is possible to track the modification of the input shapes during the operations. Additionally to standard history methods, the algorithm provides the the method GetOrigins() which allows obtaining the input shapes from which the resulting shape has been created.

    The algorithm supports the parallel processing mode, which allows faster completion of the operations.

    The algorithm returns the following Error/Warning messages:

    • BOPAlgo_AlertTooFewArguments - error alert is given on the attempt to run the algorithm without the arguments;
    • BOPAlgo_AlertMultiDimensionalArguments - error alert is given on the attempt to run the algorithm on multi-dimensional arguments;
    • BOPAlgo_AlertUnableToGlue - error alert is given if the gluer algorithm is unable to glue the given arguments;
    • BOPAlgo_AlertUnableToMakePeriodic - warning alert is given if the periodicity maker is unable to make the connected shape periodic with given options;
    • BOPAlgo_AlertShapeIsNotPeriodic - warning alert is given on the attempt to repeat the shape before making it periodic.

    Here is the example of usage of the algorithm:

    NCollection_List<TopoDS_Shape> anArguments = ...; // Shapes to make connected
    bool bRunParallel = ...; // Parallel processing mode
    BOPAlgo_MakeConnected aMC; // Tool for making the shapes connected
    aMC.SetArguments(anArguments); // Set the shapes
    aMC.SetRunParallel(bRunParallel); // Set parallel processing mode
    aMC.Perform(); // Perform the operation
    if (aMC.HasErrors()) // Check for the errors
    {
    // errors treatment
    Standard_SStream aSStream;
    aMC.DumpErrors(aSStream);
    return;
    }
    if (aMC.HasWarnings()) // Check for the warnings
    {
    // warnings treatment
    Standard_SStream aSStream;
    aMC.DumpWarnings(aSStream);
    }
    const TopoDS_Shape& aGluedShape = aMC.Shape(); // Connected shape
    // Checking material associations
    TopAbs_ShapeEnum anElemType = ...; // Type of border element
    TopExp_Explorer anExp(anArguments.First(), anElemType);
    for (; anExp.More(); anExp.Next())
    {
    const TopoDS_Shape& anElement = anExp.Current();
    const NCollection_List<TopoDS_Shape>& aNegativeM = aMC.MaterialsOnNegativeSide(anElement);
    const NCollection_List<TopoDS_Shape>& aPositiveM = aMC.MaterialsOnPositiveSide(anElement);
    }
    // Making the connected shape periodic
    BOPAlgo_MakePeriodic::PeriodicityParams aParams = ...; // Options for periodicity of the
    connected shape aMC.MakePeriodic(aParams);
    // Shape repetition after making it periodic
    // Check if the shape has been made periodic successfully
    {
    // Periodicity maker error treatment
    }
    // Shape repetition in periodic directions
    aMC.RepeatShape(0, 2);
    const TopoDS_Shape& aShape = aMC.PeriodicShape(); // Periodic and repeated shape
    std::stringstream Standard_SStream
    Defines Standard_SStream as typedef to C++ string stream.
    Definition Standard_SStream.hxx:21
    TopAbs_ShapeEnum
    Identifies various topological shapes. This enumeration allows you to use dynamic typing of shapes....
    Definition TopAbs_ShapeEnum.hxx:46
    void MakePeriodic(const BOPAlgo_MakePeriodic::PeriodicityParams &theParams)
    Performs repetition of the periodic shape in specified direction required number of times.
    BOPAlgo_MakeConnected()=default
    const NCollection_List< TopoDS_Shape > & MaterialsOnNegativeSide(const TopoDS_Shape &theS)
    Returns the original shapes which images contain the the given shape with REVERSED orientation.
    Definition BOPAlgo_MakeConnected.hxx:192
    void SetArguments(const NCollection_List< TopoDS_Shape > &theArgs)
    Adds the shape to the arguments.
    Definition BOPAlgo_MakeConnected.hxx:145
    const BOPAlgo_MakePeriodic & PeriodicityTool() const
    Returns the periodicity tool.
    Definition BOPAlgo_MakeConnected.hxx:177
    const TopoDS_Shape & PeriodicShape() const
    Returns the resulting periodic & repeated shape.
    Definition BOPAlgo_MakeConnected.hxx:222
    const TopoDS_Shape & Shape() const
    Returns the resulting periodic & repeated shape.
    Definition BOPAlgo_MakeConnected.hxx:219
    void RepeatShape(const int theDirectionID, const int theTimes)
    Performs repetition of the periodic shape in specified direction required number of times.
    const NCollection_List< TopoDS_Shape > & MaterialsOnPositiveSide(const TopoDS_Shape &theS)
    Returns the original shapes which images contain the the given shape with REVERSED orientation.
    Definition BOPAlgo_MakeConnected.hxx:183
    bool HasErrors() const
    Returns true if algorithm has failed.
    Definition BOPAlgo_Options.hxx:73
    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.
    bool HasWarnings() const
    Returns true if algorithm has generated some warning alerts.
    Definition BOPAlgo_Options.hxx:82
    void SetRunParallel(const bool theFlag)
    Set the flag of parallel processing if <theFlag> is true the parallel processing is switched on if <t...
    Definition BOPAlgo_Options.hxx:114
    Definition NCollection_List.hxx:33
    const TheItemType & First() const
    First item.
    Definition NCollection_List.hxx:154

    Constructor & Destructor Documentation

    ◆ BOPAlgo_MakeConnected()

    BOPAlgo_MakeConnected::BOPAlgo_MakeConnected ( )
    default

    Member Function Documentation

    ◆ AddArgument()

    void BOPAlgo_MakeConnected::AddArgument ( const TopoDS_Shape & theS)
    inline

    Adds the shape to the arguments.

    Parameters
    [in]theSOne of the argument shapes.

    ◆ Arguments()

    const NCollection_List< TopoDS_Shape > & BOPAlgo_MakeConnected::Arguments ( ) const
    inline

    Returns the list of arguments of the operation.

    ◆ AssociateMaterials()

    void BOPAlgo_MakeConnected::AssociateMaterials ( )
    protected

    Associates the materials transitions for the border elements:

    • For input Solids, associates the Faces to Solids;
    • For input Faces, associates the Edges to Faces;
    • For input Edges, associates the Vertices to Edges.

    ◆ CheckData()

    void BOPAlgo_MakeConnected::CheckData ( )
    protected

    Makes the argument shapes connected (or glued).

    ◆ Clear()

    void BOPAlgo_MakeConnected::Clear ( )
    inlineoverridevirtual

    Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.

    Reimplemented from BOPAlgo_Options.

    ◆ ClearRepetitions()

    void BOPAlgo_MakeConnected::ClearRepetitions ( )

    Clears the repetitions performed on the periodic shape, keeping the shape periodic.

    ◆ FillOrigins()

    void BOPAlgo_MakeConnected::FillOrigins ( )
    protected

    Fills the map of origins.

    ◆ GetModified()

    const NCollection_List< TopoDS_Shape > & BOPAlgo_MakeConnected::GetModified ( const TopoDS_Shape & theS)
    inline

    Returns the list of shapes modified from the given shape.

    Parameters
    [in]theSThe shape for which the modified shapes are necessary.

    ◆ GetOrigins()

    const NCollection_List< TopoDS_Shape > & BOPAlgo_MakeConnected::GetOrigins ( const TopoDS_Shape & theS)
    inline

    Returns the list of original shapes from which the current shape has been created.

    Parameters
    [in]theSThe shape for which the origins are necessary.

    ◆ History()

    const occ::handle< BRepTools_History > & BOPAlgo_MakeConnected::History ( ) const
    inline

    Returns the list of shapes modified from the given shape.

    Parameters
    [in]theSThe shape for which the modified shapes are necessary.

    ◆ MakeConnected()

    void BOPAlgo_MakeConnected::MakeConnected ( )
    protected

    Makes the argument shapes connected (or glued).

    ◆ MakePeriodic()

    void BOPAlgo_MakeConnected::MakePeriodic ( const BOPAlgo_MakePeriodic::PeriodicityParams & theParams)

    Performs repetition of the periodic shape in specified direction required number of times.

    Parameters
    [in]theDirectionIDThe direction's ID (0 for X, 1 for Y, 2 for Z);
    [in]theTimesRequested number of repetitions (sign of the value defines the side of the repetition direction (positive or negative)).

    ◆ MaterialsOnNegativeSide()

    const NCollection_List< TopoDS_Shape > & BOPAlgo_MakeConnected::MaterialsOnNegativeSide ( const TopoDS_Shape & theS)
    inline

    Returns the original shapes which images contain the the given shape with REVERSED orientation.

    Parameters
    [in]theSThe shape for which the materials are necessary.

    ◆ MaterialsOnPositiveSide()

    const NCollection_List< TopoDS_Shape > & BOPAlgo_MakeConnected::MaterialsOnPositiveSide ( const TopoDS_Shape & theS)
    inline

    Returns the original shapes which images contain the the given shape with REVERSED orientation.

    Parameters
    [in]theSThe shape for which the materials are necessary.

    ◆ Perform()

    void BOPAlgo_MakeConnected::Perform ( )

    ◆ PeriodicityTool()

    const BOPAlgo_MakePeriodic & BOPAlgo_MakeConnected::PeriodicityTool ( ) const
    inline

    Returns the periodicity tool.

    ◆ PeriodicShape()

    const TopoDS_Shape & BOPAlgo_MakeConnected::PeriodicShape ( ) const
    inline

    Returns the resulting periodic & repeated shape.

    ◆ RepeatShape()

    void BOPAlgo_MakeConnected::RepeatShape ( const int theDirectionID,
    const int theTimes )

    Performs repetition of the periodic shape in specified direction required number of times.

    Parameters
    [in]theDirectionIDThe direction's ID (0 for X, 1 for Y, 2 for Z);
    [in]theTimesRequested number of repetitions (sign of the value defines the side of the repetition direction (positive or negative)).

    ◆ SetArguments()

    void BOPAlgo_MakeConnected::SetArguments ( const NCollection_List< TopoDS_Shape > & theArgs)
    inline

    Adds the shape to the arguments.

    Parameters
    [in]theSOne of the argument shapes.

    ◆ Shape()

    const TopoDS_Shape & BOPAlgo_MakeConnected::Shape ( ) const
    inline

    Returns the resulting periodic & repeated shape.

    ◆ Update()

    void BOPAlgo_MakeConnected::Update ( )
    protected

    Updates the history, material associations, origins map after periodicity operations.

    Field Documentation

    ◆ myAllInputsMap

    NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> BOPAlgo_MakeConnected::myAllInputsMap
    protected

    Map of all BRep sub-elements of the input shapes.

    ◆ myArguments

    NCollection_List<TopoDS_Shape> BOPAlgo_MakeConnected::myArguments
    protected

    Input shapes for making them connected.

    ◆ myGlued

    TopoDS_Shape BOPAlgo_MakeConnected::myGlued
    protected

    The resulting connected (glued) shape.

    ◆ myGlueHistory

    occ::handle<BRepTools_History> BOPAlgo_MakeConnected::myGlueHistory
    protected

    Gluing History.

    ◆ myHistory

    occ::handle<BRepTools_History> BOPAlgo_MakeConnected::myHistory
    protected

    Final History of shapes modifications (including making the shape periodic and repetitions).

    ◆ myMaterials

    NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape> > BOPAlgo_MakeConnected::myMaterials
    protected

    Map of the materials associations for the border elements.

    ◆ myOrigins

    Map of origins (allows tracking the shape's ancestors).

    ◆ myPeriodicityMaker

    BOPAlgo_MakePeriodic BOPAlgo_MakeConnected::myPeriodicityMaker
    protected

    Tool for making the shape periodic.

    ◆ myShape

    TopoDS_Shape BOPAlgo_MakeConnected::myShape
    protected

    The resulting shape.


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