Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:12

0001 // Created on: 1995-06-22
0002 // Created by: Flore Lantheaume
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepFilletAPI_MakeChamfer_HeaderFile
0018 #define _BRepFilletAPI_MakeChamfer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <ChFi3d_ChBuilder.hxx>
0025 #include <TopTools_MapOfShape.hxx>
0026 #include <BRepFilletAPI_LocalOperation.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <TopTools_ListOfShape.hxx>
0030 #include <ChFiDS_SecHArray1.hxx>
0031 class TopoDS_Shape;
0032 class TopoDS_Edge;
0033 class TopoDS_Face;
0034 class TopoDS_Vertex;
0035 class TopOpeBRepBuild_HBuilder;
0036 
0037 
0038 //! Describes functions to build chamfers on edges of a shell or solid.
0039 //! Chamfered Edge of a Shell or Solid
0040 //! A MakeChamfer object provides a framework for:
0041 //! -   initializing the construction algorithm with a given shape,
0042 //! -   acquiring the data characterizing the chamfers,
0043 //! -   building the chamfers and constructing the resulting shape, and
0044 //! -   consulting the result.
0045 class BRepFilletAPI_MakeChamfer  : public BRepFilletAPI_LocalOperation
0046 {
0047 public:
0048 
0049   DEFINE_STANDARD_ALLOC
0050 
0051   
0052   //! Initializes an algorithm for computing chamfers on the shape S.
0053   //! The edges on which chamfers are built are defined using the Add function.
0054   Standard_EXPORT BRepFilletAPI_MakeChamfer(const TopoDS_Shape& S);
0055   
0056   //! Adds edge E to the table of edges used by this
0057   //! algorithm to build chamfers, where the parameters
0058   //! of the chamfer must be set after the
0059   Standard_EXPORT void Add (const TopoDS_Edge& E) Standard_OVERRIDE;
0060   
0061   //! Adds edge E to the table of edges used by this
0062   //! algorithm to build chamfers, where
0063   //! the parameters of the chamfer are given by
0064   //! the distance Dis (symmetric chamfer).
0065   //! The Add function results in a contour being built by
0066   //! propagation from the edge E (i.e. the contour contains at
0067   //! least this edge). This contour is composed of edges of
0068   //! the shape which are tangential to one another and
0069   //! which delimit two series of tangential faces, with one
0070   //! series of faces being located on either side of the contour.
0071   //! Warning
0072   //! Nothing is done if edge E or the face F does not belong to the initial shape.
0073   Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
0074   
0075   //! Sets the distances Dis1 and Dis2 which give the
0076   //! parameters of the chamfer along the contour of index
0077   //! IC generated using the Add function in the internal
0078   //! data structure of this algorithm. The face F identifies
0079   //! the side where Dis1 is measured.
0080   //! Warning
0081   //! Nothing is done if either the edge E or the face F
0082   //! does not belong to the initial shape.
0083   Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
0084   
0085   Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
0086   
0087   //! Adds edge E to the table of edges used by this
0088   //! algorithm to build chamfers, where
0089   //! the parameters of the chamfer are given by the two
0090   //! distances Dis1 and Dis2; the face F identifies the side
0091   //! where Dis1 is measured.
0092   //! The Add function results in a contour being built by
0093   //! propagation from the edge E (i.e. the contour contains at
0094   //! least this edge). This contour is composed of edges of
0095   //! the shape which are tangential to one another and
0096   //! which delimit two series of tangential faces, with one
0097   //! series of faces being located on either side of the contour.
0098   //! Warning
0099   //! Nothing is done if edge E or the face F does not belong to the initial shape.
0100   Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
0101   
0102   //! Sets the distances Dis1 and Dis2 which give the
0103   //! parameters of the chamfer along the contour of index
0104   //! IC generated using the Add function in the internal
0105   //! data structure of this algorithm. The face F identifies
0106   //! the side where Dis1 is measured.
0107   //! Warning
0108   //! Nothing is done if either the edge E or the face F
0109   //! does not belong to the initial shape.
0110   Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
0111   
0112   //! Returns the distances Dis1 and Dis2 which give the
0113   //! parameters of the chamfer along the contour of index IC
0114   //! in the internal data structure of this algorithm.
0115   //! Warning
0116   //! -1. is returned if IC is outside the bounds of the table of contours.
0117   Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
0118   
0119   //! Adds a  fillet contour in  the  builder  (builds a
0120   //! contour  of tangent edges to <E> and sets the
0121   //! distance <Dis1> and angle <Angle> ( parameters of the chamfer ) ).
0122   Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
0123   
0124   //! set the distance <Dis> and <Angle> of the fillet
0125   //! contour of index <IC> in the DS with <Dis> on <F>.
0126   //! if the face <F> is not one of common faces
0127   //! of an edge of the contour <IC>
0128   Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
0129   
0130   //! gives the distances <Dis> and <Angle> of the fillet
0131   //! contour of index <IC> in the DS
0132   Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle) const;
0133   
0134   //! Sets the mode of chamfer
0135   Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
0136   
0137   //! return True if chamfer symmetric false else.
0138   Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
0139   
0140   //! return True if chamfer is made with two distances false else.
0141   Standard_EXPORT Standard_Boolean IsTwoDistances (const Standard_Integer IC) const;
0142   
0143   //! return True if chamfer is made with distance and angle false else.
0144   Standard_EXPORT Standard_Boolean IsDistanceAngle (const Standard_Integer IC) const;
0145   
0146   //! Erases the chamfer parameters on the contour of
0147   //! index IC in the internal data structure of this algorithm.
0148   //! Use the SetDists function to reset this data.
0149   //! Warning
0150   //! Nothing is done if IC is outside the bounds of the table of contours.
0151   Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE;
0152   
0153   //! Returns the number of contours generated using the
0154   //! Add function in the internal data structure of this algorithm.
0155   Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE;
0156   
0157   //! Returns the index of the contour in the internal data
0158   //! structure of this algorithm, which contains the edge E of the shape.
0159   //! This function returns 0 if the edge E does not belong to any contour.
0160   //! Warning
0161   //! This index can change if a contour is removed from the
0162   //! internal data structure of this algorithm using the function Remove.
0163   Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE;
0164   
0165   //! Returns the number of edges in the contour of index I in
0166   //! the internal data structure of this algorithm.
0167   //! Warning
0168   //! Returns 0 if I is outside the bounds of the table of contours.
0169   Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE;
0170   
0171   //! Returns the edge of index J in the contour of index I in
0172   //! the internal data structure of this algorithm.
0173   //! Warning
0174   //! Returns a null shape if:
0175   //! -   I is outside the bounds of the table of contours, or
0176   //! -   J is outside the bounds of the table of edges of the contour of index I.
0177   Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE;
0178   
0179   //! Removes the contour in the internal data structure of
0180   //! this algorithm which contains the edge E of the shape.
0181   //! Warning
0182   //! Nothing is done if the edge E does not belong to the
0183   //! contour in the internal data structure of this algorithm.
0184   Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE;
0185   
0186   //! Returns the length of the contour of index IC in the
0187   //! internal data structure of this algorithm.
0188   //! Warning
0189   //! Returns -1. if IC is outside the bounds of the table of contours.
0190   Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE;
0191   
0192   //! Returns the first vertex of the contour of index IC
0193   //! in the internal data structure of this algorithm.
0194   //! Warning
0195   //! Returns a null shape if IC is outside the bounds of the table of contours.
0196   Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE;
0197   
0198   //! Returns the last vertex of the contour of index IC
0199   //! in the internal data structure of this algorithm.
0200   //! Warning
0201   //! Returns a null shape if IC is outside the bounds of the table of contours.
0202   Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE;
0203   
0204   //! Returns the curvilinear abscissa of the vertex V on the
0205   //! contour of index IC in the internal data structure of this algorithm.
0206   //! Warning
0207   //! Returns -1. if:
0208   //! -   IC is outside the bounds of the table of contours, or
0209   //! -   V is not on the contour of index IC.
0210   Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
0211   
0212   //! Returns the relative curvilinear abscissa (i.e. between 0
0213   //! and 1) of the vertex V on the contour of index IC in the
0214   //! internal data structure of this algorithm.
0215   //! Warning
0216   //! Returns -1. if:
0217   //! -   IC is outside the bounds of the table of contours, or
0218   //! -   V is not on the contour of index IC.
0219   Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
0220   
0221   //! eturns true if the contour of index IC in the internal
0222   //! data structure of this algorithm is closed and tangential at the point of closure.
0223   //! Warning
0224   //! Returns false if IC is outside the bounds of the table of contours.
0225   Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE;
0226   
0227   //! Returns true if the contour of index IC in the internal
0228   //! data structure of this algorithm is closed.
0229   //! Warning
0230   //! Returns false if IC is outside the bounds of the table of contours.
0231   Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE;
0232   
0233   //! Builds the chamfers on all the contours in the internal
0234   //! data structure of this algorithm and constructs the resulting shape.
0235   //! Use the function IsDone to verify that the chamfered
0236   //! shape is built. Use the function Shape to retrieve the chamfered shape.
0237   //! Warning
0238   //! The construction of chamfers implements highly complex
0239   //! construction algorithms. Consequently, there may be
0240   //! instances where the algorithm fails, for example if the
0241   //! data defining the parameters of the chamfer is not
0242   //! compatible with the geometry of the initial shape. There
0243   //! is no initial analysis of errors and these only become
0244   //! evident at the construction stage.
0245   //! Additionally, in the current software release, the following
0246   //! cases are not handled:
0247   //! -   the end point of the contour is the point of
0248   //! intersection of 4 or more edges of the shape, or
0249   //! -   the intersection of the chamfer with a face which
0250   //! limits the contour is not fully contained in this face.
0251   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0252   
0253   //! Reinitializes this algorithm, thus canceling the effects of the Build function.
0254   //! This function allows modifications to be made to the
0255   //! contours and chamfer parameters in order to rebuild the shape.
0256   Standard_EXPORT void Reset() Standard_OVERRIDE;
0257   
0258   //! Returns the internal filleting algorithm.
0259   Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const;
0260   
0261   //! Returns the  list   of shapes generated   from the
0262   //! shape <EorV>.
0263   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE;
0264   
0265   //! Returns the list  of shapes modified from the shape
0266   //! <F>.
0267   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
0268   
0269   Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE;
0270   
0271   Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE;
0272   
0273   Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE;
0274   
0275   Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE;
0276 
0277 
0278 
0279 
0280 protected:
0281 
0282 
0283 
0284 
0285 
0286 private:
0287 
0288 
0289 
0290   ChFi3d_ChBuilder myBuilder;
0291   TopTools_MapOfShape myMap;
0292 
0293 
0294 };
0295 
0296 
0297 
0298 
0299 
0300 
0301 
0302 #endif // _BRepFilletAPI_MakeChamfer_HeaderFile