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

    The BRepTools package provides utilities for BRep data structures. More...

    #include <BRepTools.hxx>

    Static Public Member Functions

    static void UVBounds (const TopoDS_Face &F, double &UMin, double &UMax, double &VMin, double &VMax)
     Returns in UMin, UMax, VMin, VMax the bounding values in the parametric space of F.
    static void UVBounds (const TopoDS_Face &F, const TopoDS_Wire &W, double &UMin, double &UMax, double &VMin, double &VMax)
     Returns in UMin, UMax, VMin, VMax the bounding values of the wire in the parametric space of F.
    static void UVBounds (const TopoDS_Face &F, const TopoDS_Edge &E, double &UMin, double &UMax, double &VMin, double &VMax)
     Returns in UMin, UMax, VMin, VMax the bounding values of the edge in the parametric space of F.
    static void AddUVBounds (const TopoDS_Face &F, Bnd_Box2d &B)
     Adds to the box the bounding values in the parametric space of F.
    static void AddUVBounds (const TopoDS_Face &F, const TopoDS_Wire &W, Bnd_Box2d &B)
     Adds to the box the bounding values of the wire in the parametric space of F.
    static void AddUVBounds (const TopoDS_Face &F, const TopoDS_Edge &E, Bnd_Box2d &B)
     Adds to the box the bounding values of the edge in the parametric space of F.
    static void Update (const TopoDS_Vertex &V)
     Update a vertex (nothing is done).
    static void Update (const TopoDS_Edge &E)
     Update an edge, compute 2d bounding boxes.
    static void Update (const TopoDS_Wire &W)
     Update a wire (nothing is done).
    static void Update (const TopoDS_Face &F)
     Update a Face, update UV points.
    static void Update (const TopoDS_Shell &S)
     Update a shell (nothing is done).
    static void Update (const TopoDS_Solid &S)
     Update a solid (nothing is done).
    static void Update (const TopoDS_CompSolid &C)
     Update a composite solid (nothing is done).
    static void Update (const TopoDS_Compound &C)
     Update a compound (nothing is done).
    static void Update (const TopoDS_Shape &S)
     Update a shape, call the correct update.
    static void UpdateFaceUVPoints (const TopoDS_Face &theF)
     For each edge of the face <F> reset the UV points to the bounding points of the parametric curve of the edge on the face.
    static void Clean (const TopoDS_Shape &theShape, const bool theForce=false)
     Removes all cached polygonal representation of the shape, i.e. the triangulations of the faces of and polygons on triangulations and polygons 3d of the edges. In case polygonal representation is the only available representation for the shape (shape does not have geometry) it is not removed.
    static void CleanGeometry (const TopoDS_Shape &theShape)
     Removes geometry (curves and surfaces) from all edges and faces of the shape.
    static void RemoveUnusedPCurves (const TopoDS_Shape &S)
     Removes all the pcurves of the edges of that refer to surfaces not belonging to any face of .
    static bool Triangulation (const TopoDS_Shape &theShape, const double theLinDefl, const bool theToCheckFreeEdges=false)
     Verifies that each Face from the shape has got a triangulation with a deflection smaller or equal to specified one and the Edges a discretization on this triangulation.
    static bool LoadTriangulation (const TopoDS_Shape &theShape, const int theTriangulationIdx=-1, const bool theToSetAsActive=false, const occ::handle< OSD_FileSystem > &theFileSystem=occ::handle< OSD_FileSystem >())
     Loads triangulation data for each face of the shape from some deferred storage using specified shared input file system.
    static bool UnloadTriangulation (const TopoDS_Shape &theShape, const int theTriangulationIdx=-1)
     Releases triangulation data for each face of the shape if there is deferred storage to load it later.
    static bool ActivateTriangulation (const TopoDS_Shape &theShape, const int theTriangulationIdx, const bool theToActivateStrictly=false)
     Activates triangulation data for each face of the shape from some deferred storage using specified shared input file system.
    static bool LoadAllTriangulations (const TopoDS_Shape &theShape, const occ::handle< OSD_FileSystem > &theFileSystem=occ::handle< OSD_FileSystem >())
     Loads all available triangulations for each face of the shape from some deferred storage using specified shared input file system.
    static bool UnloadAllTriangulations (const TopoDS_Shape &theShape)
     Releases all available triangulations for each face of the shape if there is deferred storage to load them later.
    static bool Compare (const TopoDS_Vertex &V1, const TopoDS_Vertex &V2)
     Returns True if the distance between the two vertices is lower than their tolerance.
    static bool Compare (const TopoDS_Edge &E1, const TopoDS_Edge &E2)
     Returns True if the distance between the two edges is lower than their tolerance.
    static TopoDS_Wire OuterWire (const TopoDS_Face &F)
     Returns the outer most wire of <F>. Returns a Null wire if <F> has no wires.
    static void Map3DEdges (const TopoDS_Shape &S, NCollection_IndexedMap< TopoDS_Shape, TopTools_ShapeMapHasher > &M)
     Stores in the map <M> all the 3D topology edges of .
    static bool IsReallyClosed (const TopoDS_Edge &E, const TopoDS_Face &F)
     Verifies that the edge <E> is found two times on the face <F> before calling BRep_Tool::IsClosed.
    static void DetectClosedness (const TopoDS_Face &theFace, bool &theUclosed, bool &theVclosed)
     Detect closedness of face in U and V directions.
    static void Dump (const TopoDS_Shape &Sh, Standard_OStream &S)
     Dumps the topological structure and the geometry of <Sh> on the stream .
    static void Write (const TopoDS_Shape &theShape, Standard_OStream &theStream, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Writes the shape to the stream in an ASCII format TopTools_FormatVersion_VERSION_1. This alias writes shape with triangulation data.
    static void Write (const TopoDS_Shape &theShape, Standard_OStream &theStream, const bool theWithTriangles, const bool theWithNormals, const TopTools_FormatVersion theVersion, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Writes the shape to the stream in an ASCII format of specified version.
    static void Read (TopoDS_Shape &Sh, Standard_IStream &S, const BRep_Builder &B, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Reads a Shape from in returns it in <Sh>. is used to build the shape.
    static bool Write (const TopoDS_Shape &theShape, const char *const theFile, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Writes the shape to the file in an ASCII format TopTools_FormatVersion_VERSION_1. This alias writes shape with triangulation data.
    static bool Write (const TopoDS_Shape &theShape, const char *const theFile, const bool theWithTriangles, const bool theWithNormals, const TopTools_FormatVersion theVersion, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Writes the shape to the file in an ASCII format of specified version.
    static bool Read (TopoDS_Shape &Sh, const char *const File, const BRep_Builder &B, const Message_ProgressRange &theProgress=Message_ProgressRange())
     Reads a Shape from <File>, returns it in <Sh>. is used to build the shape.
    static double EvalAndUpdateTol (const TopoDS_Edge &theE, const occ::handle< Geom_Curve > &theC3d, const occ::handle< Geom2d_Curve > &theC2d, const occ::handle< Geom_Surface > &theS, const double theF, const double theL)
     Evals real tolerance of edge <theE>. <theC3d>, <theC2d>, <theS>, <theF>, <theL> are correspondently 3d curve of edge, 2d curve on surface <theS> and rang of edge If calculated tolerance is more then current edge tolerance, edge is updated. Method returns actual tolerance of edge.
    static TopAbs_Orientation OriEdgeInFace (const TopoDS_Edge &theEdge, const TopoDS_Face &theFace)
     returns the cumul of the orientation of <Edge> and the containing wire in <Face>
    static void RemoveInternals (TopoDS_Shape &theS, const bool theForce=false)
     Removes internal sub-shapes from the shape. The check on internal status is based on orientation of sub-shapes, classification is not performed. Before removal of internal sub-shapes the algorithm checks if such removal is not going to break topological connectivity between sub-shapes. The flag <theForce> if set to true disables the connectivity check and clears the given shape from all sub-shapes with internal orientation.
    static void CheckLocations (const TopoDS_Shape &theS, NCollection_List< TopoDS_Shape > &theProblemShapes)
     Check all locations of shape according criterium: aTrsf.IsNegative() || (std::abs(std::abs(aTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec()) All sub-shapes having such locations are put in list theProblemShapes.

    Detailed Description

    The BRepTools package provides utilities for BRep data structures.

    • WireExplorer: Tool to explore the topology of a wire in the order of the edges.
    • ShapeSet: Tools used for dumping, writing and reading.
    • UVBounds: Methods to compute the limits of the boundary of a face, a wire or an edge in the parametric space of a face.
    • Update: Methods to call when a topology has been created to compute all missing data.
    • UpdateFaceUVPoints: Method to update the UV points stored with the edges on a face.
    • Compare: Method to compare two vertices.
    • Compare: Method to compare two edges.
    • OuterWire: Method to find the outer wire of a face.
    • Map3DEdges: Method to map all the 3D Edges of a Shape.
    • Dump: Method to dump a BRep object.

    Member Function Documentation

    ◆ ActivateTriangulation()

    bool BRepTools::ActivateTriangulation ( const TopoDS_Shape & theShape,
    const int theTriangulationIdx,
    const bool theToActivateStrictly = false )
    static

    Activates triangulation data for each face of the shape from some deferred storage using specified shared input file system.

    Parameters
    [in]theShapeshape to activate triangulations
    [in]theTriangulationIdxindex defining what triangulation should be activated. Starts from 0. Exception will be thrown in case of invalid negative index
    [in]theToActivateStrictlyflag to activate exactly triangulation with defined theTriangulationIdx index. In TRUE case if some face doesn't contain triangulation with this index, active triangulation will not be changed for it. Else the last available triangulation will be activated.
    Returns
    TRUE if at least one active triangulation was changed.

    ◆ AddUVBounds() [1/3]

    void BRepTools::AddUVBounds ( const TopoDS_Face & F,
    Bnd_Box2d & B )
    static

    Adds to the box the bounding values in the parametric space of F.

    ◆ AddUVBounds() [2/3]

    void BRepTools::AddUVBounds ( const TopoDS_Face & F,
    const TopoDS_Edge & E,
    Bnd_Box2d & B )
    static

    Adds to the box the bounding values of the edge in the parametric space of F.

    ◆ AddUVBounds() [3/3]

    void BRepTools::AddUVBounds ( const TopoDS_Face & F,
    const TopoDS_Wire & W,
    Bnd_Box2d & B )
    static

    Adds to the box the bounding values of the wire in the parametric space of F.

    ◆ CheckLocations()

    void BRepTools::CheckLocations ( const TopoDS_Shape & theS,
    NCollection_List< TopoDS_Shape > & theProblemShapes )
    static

    Check all locations of shape according criterium: aTrsf.IsNegative() || (std::abs(std::abs(aTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec()) All sub-shapes having such locations are put in list theProblemShapes.

    ◆ Clean()

    void BRepTools::Clean ( const TopoDS_Shape & theShape,
    const bool theForce = false )
    static

    Removes all cached polygonal representation of the shape, i.e. the triangulations of the faces of and polygons on triangulations and polygons 3d of the edges. In case polygonal representation is the only available representation for the shape (shape does not have geometry) it is not removed.

    Parameters
    [in]theShapethe shape to clean
    [in]theForceallows removing all polygonal representations from the shape, including polygons on triangulations irrelevant for the faces of the given shape.

    ◆ CleanGeometry()

    void BRepTools::CleanGeometry ( const TopoDS_Shape & theShape)
    static

    Removes geometry (curves and surfaces) from all edges and faces of the shape.

    ◆ Compare() [1/2]

    bool BRepTools::Compare ( const TopoDS_Edge & E1,
    const TopoDS_Edge & E2 )
    static

    Returns True if the distance between the two edges is lower than their tolerance.

    ◆ Compare() [2/2]

    bool BRepTools::Compare ( const TopoDS_Vertex & V1,
    const TopoDS_Vertex & V2 )
    static

    Returns True if the distance between the two vertices is lower than their tolerance.

    ◆ DetectClosedness()

    void BRepTools::DetectClosedness ( const TopoDS_Face & theFace,
    bool & theUclosed,
    bool & theVclosed )
    static

    Detect closedness of face in U and V directions.

    ◆ Dump()

    void BRepTools::Dump ( const TopoDS_Shape & Sh,
    Standard_OStream & S )
    static

    Dumps the topological structure and the geometry of <Sh> on the stream .

    ◆ EvalAndUpdateTol()

    double BRepTools::EvalAndUpdateTol ( const TopoDS_Edge & theE,
    const occ::handle< Geom_Curve > & theC3d,
    const occ::handle< Geom2d_Curve > & theC2d,
    const occ::handle< Geom_Surface > & theS,
    const double theF,
    const double theL )
    static

    Evals real tolerance of edge <theE>. <theC3d>, <theC2d>, <theS>, <theF>, <theL> are correspondently 3d curve of edge, 2d curve on surface <theS> and rang of edge If calculated tolerance is more then current edge tolerance, edge is updated. Method returns actual tolerance of edge.

    ◆ IsReallyClosed()

    bool BRepTools::IsReallyClosed ( const TopoDS_Edge & E,
    const TopoDS_Face & F )
    static

    Verifies that the edge <E> is found two times on the face <F> before calling BRep_Tool::IsClosed.

    ◆ LoadAllTriangulations()

    bool BRepTools::LoadAllTriangulations ( const TopoDS_Shape & theShape,
    const occ::handle< OSD_FileSystem > & theFileSystem = occ::handleOSD_FileSystem >() )
    static

    Loads all available triangulations for each face of the shape from some deferred storage using specified shared input file system.

    Parameters
    [in]theShapeshape to load triangulations
    [in]theFileSystemshared file system
    Returns
    TRUE if at least one triangulation is loaded.

    ◆ LoadTriangulation()

    bool BRepTools::LoadTriangulation ( const TopoDS_Shape & theShape,
    const int theTriangulationIdx = -1,
    const bool theToSetAsActive = false,
    const occ::handle< OSD_FileSystem > & theFileSystem = occ::handleOSD_FileSystem >() )
    static

    Loads triangulation data for each face of the shape from some deferred storage using specified shared input file system.

    Parameters
    [in]theShapeshape to load triangulations
    [in]theTriangulationIdxindex defining what triangulation should be loaded. Starts from 0. -1 is used in specific case to load currently already active triangulation. If some face doesn't contain triangulation with this index, nothing will be loaded for it. Exception will be thrown in case of invalid negative index
    [in]theToSetAsActiveflag to activate triangulation after its loading
    [in]theFileSystemshared file system
    Returns
    TRUE if at least one triangulation is loaded.

    ◆ Map3DEdges()

    void BRepTools::Map3DEdges ( const TopoDS_Shape & S,
    NCollection_IndexedMap< TopoDS_Shape, TopTools_ShapeMapHasher > & M )
    static

    Stores in the map <M> all the 3D topology edges of .

    ◆ OriEdgeInFace()

    TopAbs_Orientation BRepTools::OriEdgeInFace ( const TopoDS_Edge & theEdge,
    const TopoDS_Face & theFace )
    static

    returns the cumul of the orientation of <Edge> and the containing wire in <Face>

    ◆ OuterWire()

    TopoDS_Wire BRepTools::OuterWire ( const TopoDS_Face & F)
    static

    Returns the outer most wire of <F>. Returns a Null wire if <F> has no wires.

    ◆ Read() [1/2]

    bool BRepTools::Read ( TopoDS_Shape & Sh,
    const char *const File,
    const BRep_Builder & B,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    static

    Reads a Shape from <File>, returns it in <Sh>. is used to build the shape.

    ◆ Read() [2/2]

    void BRepTools::Read ( TopoDS_Shape & Sh,
    Standard_IStream & S,
    const BRep_Builder & B,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    static

    Reads a Shape from in returns it in <Sh>. is used to build the shape.

    ◆ RemoveInternals()

    void BRepTools::RemoveInternals ( TopoDS_Shape & theS,
    const bool theForce = false )
    static

    Removes internal sub-shapes from the shape. The check on internal status is based on orientation of sub-shapes, classification is not performed. Before removal of internal sub-shapes the algorithm checks if such removal is not going to break topological connectivity between sub-shapes. The flag <theForce> if set to true disables the connectivity check and clears the given shape from all sub-shapes with internal orientation.

    ◆ RemoveUnusedPCurves()

    void BRepTools::RemoveUnusedPCurves ( const TopoDS_Shape & S)
    static

    Removes all the pcurves of the edges of that refer to surfaces not belonging to any face of .

    ◆ Triangulation()

    bool BRepTools::Triangulation ( const TopoDS_Shape & theShape,
    const double theLinDefl,
    const bool theToCheckFreeEdges = false )
    static

    Verifies that each Face from the shape has got a triangulation with a deflection smaller or equal to specified one and the Edges a discretization on this triangulation.

    Parameters
    [in]theShapeshape to verify
    [in]theLinDeflmaximum allowed linear deflection
    [in]theToCheckFreeEdgesif TRUE, then free Edges are required to have 3D polygon
    Returns
    FALSE if input Shape contains Faces without triangulation, or that triangulation has worse (greater) deflection than specified one, or Edges in Shape lack polygons on triangulation or free Edges in Shape lack 3D polygons

    ◆ UnloadAllTriangulations()

    bool BRepTools::UnloadAllTriangulations ( const TopoDS_Shape & theShape)
    static

    Releases all available triangulations for each face of the shape if there is deferred storage to load them later.

    Parameters
    [in]theShapeshape to unload triangulations
    Returns
    TRUE if at least one triangulation is unloaded.

    ◆ UnloadTriangulation()

    bool BRepTools::UnloadTriangulation ( const TopoDS_Shape & theShape,
    const int theTriangulationIdx = -1 )
    static

    Releases triangulation data for each face of the shape if there is deferred storage to load it later.

    Parameters
    [in]theShapeshape to unload triangulations
    [in]theTriangulationIdxindex defining what triangulation should be unloaded. Starts from 0. -1 is used in specific case to unload currently already active triangulation. If some face doesn't contain triangulation with this index, nothing will be unloaded for it. Exception will be thrown in case of invalid negative index
    Returns
    TRUE if at least one triangulation is unloaded.

    ◆ Update() [1/9]

    void BRepTools::Update ( const TopoDS_Compound & C)
    static

    Update a compound (nothing is done).

    ◆ Update() [2/9]

    void BRepTools::Update ( const TopoDS_CompSolid & C)
    static

    Update a composite solid (nothing is done).

    ◆ Update() [3/9]

    void BRepTools::Update ( const TopoDS_Edge & E)
    static

    Update an edge, compute 2d bounding boxes.

    ◆ Update() [4/9]

    void BRepTools::Update ( const TopoDS_Face & F)
    static

    Update a Face, update UV points.

    ◆ Update() [5/9]

    void BRepTools::Update ( const TopoDS_Shape & S)
    static

    Update a shape, call the correct update.

    ◆ Update() [6/9]

    void BRepTools::Update ( const TopoDS_Shell & S)
    static

    Update a shell (nothing is done).

    ◆ Update() [7/9]

    void BRepTools::Update ( const TopoDS_Solid & S)
    static

    Update a solid (nothing is done).

    ◆ Update() [8/9]

    void BRepTools::Update ( const TopoDS_Vertex & V)
    static

    Update a vertex (nothing is done).

    ◆ Update() [9/9]

    void BRepTools::Update ( const TopoDS_Wire & W)
    static

    Update a wire (nothing is done).

    ◆ UpdateFaceUVPoints()

    void BRepTools::UpdateFaceUVPoints ( const TopoDS_Face & theF)
    static

    For each edge of the face <F> reset the UV points to the bounding points of the parametric curve of the edge on the face.

    ◆ UVBounds() [1/3]

    void BRepTools::UVBounds ( const TopoDS_Face & F,
    const TopoDS_Edge & E,
    double & UMin,
    double & UMax,
    double & VMin,
    double & VMax )
    static

    Returns in UMin, UMax, VMin, VMax the bounding values of the edge in the parametric space of F.

    ◆ UVBounds() [2/3]

    void BRepTools::UVBounds ( const TopoDS_Face & F,
    const TopoDS_Wire & W,
    double & UMin,
    double & UMax,
    double & VMin,
    double & VMax )
    static

    Returns in UMin, UMax, VMin, VMax the bounding values of the wire in the parametric space of F.

    ◆ UVBounds() [3/3]

    void BRepTools::UVBounds ( const TopoDS_Face & F,
    double & UMin,
    double & UMax,
    double & VMin,
    double & VMax )
    static

    Returns in UMin, UMax, VMin, VMax the bounding values in the parametric space of F.

    ◆ Write() [1/4]

    bool BRepTools::Write ( const TopoDS_Shape & theShape,
    const char *const theFile,
    const bool theWithTriangles,
    const bool theWithNormals,
    const TopTools_FormatVersion theVersion,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    static

    Writes the shape to the file in an ASCII format of specified version.

    Parameters
    [in]theShapethe shape to write
    [in]theFilethe path to file to output shape into
    [in]theWithTrianglesflag which specifies whether to save shape with (TRUE) or without (FALSE) triangles; has no effect on triangulation-only geometry
    [in]theWithNormalsflag which specifies whether to save triangulation with (TRUE) or without (FALSE) normals; has no effect on triangulation-only geometry
    [in]theVersionthe TopTools format version
    theProgressthe range of progress indicator to fill in

    ◆ Write() [2/4]

    bool BRepTools::Write ( const TopoDS_Shape & theShape,
    const char *const theFile,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    inlinestatic

    Writes the shape to the file in an ASCII format TopTools_FormatVersion_VERSION_1. This alias writes shape with triangulation data.

    Parameters
    [in]theShapethe shape to write
    [in]theFilethe path to file to output shape into
    theProgressthe range of progress indicator to fill in

    ◆ Write() [3/4]

    void BRepTools::Write ( const TopoDS_Shape & theShape,
    Standard_OStream & theStream,
    const bool theWithTriangles,
    const bool theWithNormals,
    const TopTools_FormatVersion theVersion,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    static

    Writes the shape to the stream in an ASCII format of specified version.

    Parameters
    [in]theShapethe shape to write
    [in]

    out] theStream the stream to output shape into

    Parameters
    [in]theWithTrianglesflag which specifies whether to save shape with (TRUE) or without (FALSE) triangles; has no effect on triangulation-only geometry
    [in]theWithNormalsflag which specifies whether to save triangulation with (TRUE) or without (FALSE) normals; has no effect on triangulation-only geometry
    [in]theVersionthe TopTools format version
    theProgressthe range of progress indicator to fill in

    ◆ Write() [4/4]

    void BRepTools::Write ( const TopoDS_Shape & theShape,
    Standard_OStream & theStream,
    const Message_ProgressRange & theProgress = Message_ProgressRange() )
    inlinestatic

    Writes the shape to the stream in an ASCII format TopTools_FormatVersion_VERSION_1. This alias writes shape with triangulation data.

    Parameters
    [in]theShapethe shape to write
    [in]

    out] theStream the stream to output shape into

    Parameters
    theRangethe range of progress indicator to fill in

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