OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    ShapeUpgrade_UnifySameDomain Class Reference

    This tool tries to unify faces and edges of the shape which lie on the same geometry. Faces/edges are considering as 'same-domain' if a group of neighbouring faces/edges are lying on coincident surfaces/curves. In this case these faces/edges can be unified into one face/edge. ShapeUpgrade_UnifySameDomain is initialized by a shape and the next optional parameters: UnifyFaces - tries to unify all possible faces UnifyEdges - tries to unify all possible edges ConcatBSplines - if this flag is set to true then all neighbouring edges, which lay on BSpline or Bezier curves with C1 continuity on their common vertices, will be merged into one common edge. More...

    #include <ShapeUpgrade_UnifySameDomain.hxx>

    Inheritance diagram for ShapeUpgrade_UnifySameDomain:

    Public Types

    typedef NCollection_DataMap< TopoDS_Shape, occ::handle< Geom_Plane >, TopTools_ShapeMapHasher > DataMapOfFacePlane
    typedef NCollection_DataMap< TopoDS_Shape, NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher >, TopTools_ShapeMapHasher > DataMapOfShapeMapOfShape
    typedef void base_type
     Returns a type descriptor about this object.

    Public Member Functions

     ShapeUpgrade_UnifySameDomain ()
     Empty constructor.
     ShapeUpgrade_UnifySameDomain (const TopoDS_Shape &aShape, const bool UnifyEdges=true, const bool UnifyFaces=true, const bool ConcatBSplines=false)
     Constructor defining input shape and necessary flags. It does not perform unification.
    void Initialize (const TopoDS_Shape &aShape, const bool UnifyEdges=true, const bool UnifyFaces=true, const bool ConcatBSplines=false)
     Initializes with a shape and necessary flags. It does not perform unification. If you intend to nullify the History place holder do it after initialization.
    void AllowInternalEdges (const bool theValue)
     Sets the flag defining whether it is allowed to create internal edges inside merged faces in the case of non-manifold topology. Without this flag merging through multi connected edge is forbidden. Default value is false.
    void KeepShape (const TopoDS_Shape &theShape)
     Sets the shape for avoid merging of the faces/edges. This shape can be vertex or edge. If the shape is a vertex it forbids merging of connected edges. If the shape is a edge it forbids merging of connected faces. This method can be called several times to keep several shapes.
    void KeepShapes (const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > &theShapes)
     Sets the map of shapes for avoid merging of the faces/edges. It allows passing a ready to use map instead of calling many times the method KeepShape.
    void SetSafeInputMode (bool theValue)
     Sets the flag defining the behavior of the algorithm regarding modification of input shape. If this flag is equal to True then the input (original) shape can't be modified during modification process. Default value is true.
    void SetLinearTolerance (const double theValue)
     Sets the linear tolerance. It plays the role of chord error when taking decision about merging of shapes. Default value is Precision::Confusion().
    void SetAngularTolerance (const double theValue)
     Sets the angular tolerance. If two shapes form a connection angle greater than this value they will not be merged. Default value is Precision::Angular().
    void Build ()
     Performs unification and builds the resulting shape.
    const TopoDS_Shape & Shape () const
     Gives the resulting shape.
    const occ::handle< BRepTools_History > & History () const
     Returns the history of the processed shapes.
    occ::handle< BRepTools_History > & History ()
     Returns the history of the processed shapes.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transient & operator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool IsKind (const opencascade::handle< Standard_Type > &theType) const
     Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    bool IsKind (const char *const theTypeName) const
     Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    Standard_Transient * This () const
     Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Protected Member Functions

    void UnifyFaces ()
     This method makes if possible a common face from each group of faces lying on coincident surfaces.
    void UnifyEdges ()
     This method makes if possible a common edge from each group of smothly connected edges, which are common for the same couple of faces.
    void IntUnifyFaces (const TopoDS_Shape &theInpShape, const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > &theGMapEdgeFaces, const DataMapOfShapeMapOfShape &theGMapFaceShells, const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > &theFreeBoundMap)
    bool MergeEdges (NCollection_Sequence< TopoDS_Shape > &SeqEdges, const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > &theVFmap, NCollection_Sequence< SubSequenceOfEdges > &SeqOfSubSeqOfEdges, const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > &NonMergVrt)
     Splits the sequence of edges into the sequence of chains.
    bool MergeSeq (NCollection_Sequence< TopoDS_Shape > &SeqEdges, const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > &theVFmap, const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > &nonMergVert)
     Tries to unify the sequence of edges with the set of another edges which lies on the same geometry.
    bool MergeSubSeq (const NCollection_Sequence< TopoDS_Shape > &theChain, const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > &theVFmap, TopoDS_Edge &OutEdge)
     Merges a sequence of edges into one edge if possible.
    void UnionPCurves (const NCollection_Sequence< TopoDS_Shape > &theChain, TopoDS_Edge &theEdge)
     Unifies the pcurve of the chain into one pcurve of the edge.
    void FillHistory ()
     Fills the history of the modifications during the operation.

    Additional Inherited Members

    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Detailed Description

    This tool tries to unify faces and edges of the shape which lie on the same geometry. Faces/edges are considering as 'same-domain' if a group of neighbouring faces/edges are lying on coincident surfaces/curves. In this case these faces/edges can be unified into one face/edge. ShapeUpgrade_UnifySameDomain is initialized by a shape and the next optional parameters: UnifyFaces - tries to unify all possible faces UnifyEdges - tries to unify all possible edges ConcatBSplines - if this flag is set to true then all neighbouring edges, which lay on BSpline or Bezier curves with C1 continuity on their common vertices, will be merged into one common edge.

    The input shape can be of any type containing faces or edges - compsolid, solid, shell, wire, compound of any kind of shapes. The algorithm preserves the structure of compsolids, solids, shells and wires. E.g., if two shells have a common edge and the faces sharing this edge lie on the same surface the algorithm will not unify these faces, otherwise the structure of shells would be broken. However, if such faces belong to different compounds of faces they will be unified.

    The output result of the tool is the unified shape.

    All the modifications of initial shape are recorded during unifying. Methods History are intended to:

    • set a place holder for the history of modifications of sub-shapes of the initial shape;
    • get the collected history. The algorithm provides a place holder for the history and collects the history by default. To avoid collecting of the history the place holder should be set to null handle.

    Member Typedef Documentation

    ◆ DataMapOfFacePlane

    ◆ DataMapOfShapeMapOfShape

    Constructor & Destructor Documentation

    ◆ ShapeUpgrade_UnifySameDomain() [1/2]

    ShapeUpgrade_UnifySameDomain::ShapeUpgrade_UnifySameDomain ( )

    Empty constructor.

    ◆ ShapeUpgrade_UnifySameDomain() [2/2]

    ShapeUpgrade_UnifySameDomain::ShapeUpgrade_UnifySameDomain ( const TopoDS_Shape & aShape,
    const bool UnifyEdges = true,
    const bool UnifyFaces = true,
    const bool ConcatBSplines = false )

    Constructor defining input shape and necessary flags. It does not perform unification.

    Member Function Documentation

    ◆ AllowInternalEdges()

    void ShapeUpgrade_UnifySameDomain::AllowInternalEdges ( const bool theValue)

    Sets the flag defining whether it is allowed to create internal edges inside merged faces in the case of non-manifold topology. Without this flag merging through multi connected edge is forbidden. Default value is false.

    ◆ Build()

    void ShapeUpgrade_UnifySameDomain::Build ( )

    Performs unification and builds the resulting shape.

    ◆ FillHistory()

    void ShapeUpgrade_UnifySameDomain::FillHistory ( )
    protected

    Fills the history of the modifications during the operation.

    ◆ History() [1/2]

    occ::handle< BRepTools_History > & ShapeUpgrade_UnifySameDomain::History ( )
    inline

    Returns the history of the processed shapes.

    ◆ History() [2/2]

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

    Returns the history of the processed shapes.

    ◆ Initialize()

    void ShapeUpgrade_UnifySameDomain::Initialize ( const TopoDS_Shape & aShape,
    const bool UnifyEdges = true,
    const bool UnifyFaces = true,
    const bool ConcatBSplines = false )

    Initializes with a shape and necessary flags. It does not perform unification. If you intend to nullify the History place holder do it after initialization.

    ◆ IntUnifyFaces()

    void ShapeUpgrade_UnifySameDomain::IntUnifyFaces ( const TopoDS_Shape & theInpShape,
    const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > & theGMapEdgeFaces,
    const DataMapOfShapeMapOfShape & theGMapFaceShells,
    const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > & theFreeBoundMap )
    protected

    ◆ KeepShape()

    void ShapeUpgrade_UnifySameDomain::KeepShape ( const TopoDS_Shape & theShape)

    Sets the shape for avoid merging of the faces/edges. This shape can be vertex or edge. If the shape is a vertex it forbids merging of connected edges. If the shape is a edge it forbids merging of connected faces. This method can be called several times to keep several shapes.

    ◆ KeepShapes()

    void ShapeUpgrade_UnifySameDomain::KeepShapes ( const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > & theShapes)

    Sets the map of shapes for avoid merging of the faces/edges. It allows passing a ready to use map instead of calling many times the method KeepShape.

    ◆ MergeEdges()

    bool ShapeUpgrade_UnifySameDomain::MergeEdges ( NCollection_Sequence< TopoDS_Shape > & SeqEdges,
    const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > & theVFmap,
    NCollection_Sequence< SubSequenceOfEdges > & SeqOfSubSeqOfEdges,
    const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > & NonMergVrt )
    protected

    Splits the sequence of edges into the sequence of chains.

    ◆ MergeSeq()

    bool ShapeUpgrade_UnifySameDomain::MergeSeq ( NCollection_Sequence< TopoDS_Shape > & SeqEdges,
    const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > & theVFmap,
    const NCollection_Map< TopoDS_Shape, TopTools_ShapeMapHasher > & nonMergVert )
    protected

    Tries to unify the sequence of edges with the set of another edges which lies on the same geometry.

    ◆ MergeSubSeq()

    bool ShapeUpgrade_UnifySameDomain::MergeSubSeq ( const NCollection_Sequence< TopoDS_Shape > & theChain,
    const NCollection_IndexedDataMap< TopoDS_Shape, NCollection_List< TopoDS_Shape >, TopTools_ShapeMapHasher > & theVFmap,
    TopoDS_Edge & OutEdge )
    protected

    Merges a sequence of edges into one edge if possible.

    ◆ SetAngularTolerance()

    void ShapeUpgrade_UnifySameDomain::SetAngularTolerance ( const double theValue)
    inline

    Sets the angular tolerance. If two shapes form a connection angle greater than this value they will not be merged. Default value is Precision::Angular().

    ◆ SetLinearTolerance()

    void ShapeUpgrade_UnifySameDomain::SetLinearTolerance ( const double theValue)
    inline

    Sets the linear tolerance. It plays the role of chord error when taking decision about merging of shapes. Default value is Precision::Confusion().

    ◆ SetSafeInputMode()

    void ShapeUpgrade_UnifySameDomain::SetSafeInputMode ( bool theValue)

    Sets the flag defining the behavior of the algorithm regarding modification of input shape. If this flag is equal to True then the input (original) shape can't be modified during modification process. Default value is true.

    ◆ Shape()

    const TopoDS_Shape & ShapeUpgrade_UnifySameDomain::Shape ( ) const
    inline

    Gives the resulting shape.

    ◆ UnifyEdges()

    void ShapeUpgrade_UnifySameDomain::UnifyEdges ( )
    protected

    This method makes if possible a common edge from each group of smothly connected edges, which are common for the same couple of faces.

    ◆ UnifyFaces()

    void ShapeUpgrade_UnifySameDomain::UnifyFaces ( )
    protected

    This method makes if possible a common face from each group of faces lying on coincident surfaces.

    ◆ UnionPCurves()

    void ShapeUpgrade_UnifySameDomain::UnionPCurves ( const NCollection_Sequence< TopoDS_Shape > & theChain,
    TopoDS_Edge & theEdge )
    protected

    Unifies the pcurve of the chain into one pcurve of the edge.


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