Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-08-31
0002 // Created by: Remi LEQUETTE
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_MakeFillet2d_HeaderFile
0018 #define _BRepFilletAPI_MakeFillet2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <ChFi2d_Builder.hxx>
0025 #include <BRepBuilderAPI_MakeShape.hxx>
0026 #include <TopTools_SequenceOfShape.hxx>
0027 #include <TopTools_ListOfShape.hxx>
0028 #include <ChFi2d_ConstructionError.hxx>
0029 class TopoDS_Face;
0030 class TopoDS_Edge;
0031 class TopoDS_Vertex;
0032 class TopoDS_Shape;
0033 
0034 // resolve name collisions with X11 headers
0035 #ifdef Status
0036   #undef Status
0037 #endif
0038 
0039 //! Describes functions to build fillets and chamfers on the
0040 //! vertices of a planar face.
0041 //! Fillets and Chamfers on the Vertices of a Planar Face
0042 //! A MakeFillet2d object provides a framework for:
0043 //! - initializing the construction algorithm with a given face,
0044 //! - acquiring the data characterizing the fillets and chamfers,
0045 //! -   building the fillets and chamfers, and constructing the
0046 //! resulting shape, and
0047 //! -   consulting the result.
0048 //! Warning
0049 //! Only segments of straight lines and arcs of circles are
0050 //! treated. BSplines are not processed.
0051 class BRepFilletAPI_MakeFillet2d  : public BRepBuilderAPI_MakeShape
0052 {
0053 public:
0054 
0055   DEFINE_STANDARD_ALLOC
0056 
0057   
0058   //! Initializes an empty algorithm for computing fillets and
0059   //! chamfers. The face on which the fillets and
0060   //! chamfers are built is defined using the Init function.
0061   //! The vertices on which fillets or chamfers are built are
0062   //! defined using the AddFillet or AddChamfer function.
0063   //! Warning
0064   //! The status of the initialization, as given by the Status
0065   //! function, can be one of the following:
0066   //! -   ChFi2d_Ready if the initialization is correct,
0067   //! -   ChFi2d_NotPlanar if F is not planar,
0068   //! -   ChFi2d_NoFace if F is a null face.
0069   Standard_EXPORT BRepFilletAPI_MakeFillet2d();
0070   
0071   //! Initializes an algorithm for computing fillets and chamfers on the face F.
0072   //! The vertices on which fillets or chamfers are built are
0073   //! defined using the AddFillet or AddChamfer function.
0074   //! Warning
0075   //! The status of the initialization, as given by the Status
0076   //! function, can be one of the following:
0077   //! -   ChFi2d_Ready if the initialization is correct,
0078   //! -   ChFi2d_NotPlanar if F is not planar,
0079   //! -   ChFi2d_NoFace if F is a null face.
0080   Standard_EXPORT BRepFilletAPI_MakeFillet2d(const TopoDS_Face& F);
0081   
0082   //! Initializes this algorithm for constructing fillets or
0083   //! chamfers with the face F.
0084   //! Warning
0085   //! The status of the initialization, as given by the Status
0086   //! function, can be one of the following:
0087   //! -   ChFi2d_Ready if the initialization is correct,
0088   //! -   ChFi2d_NotPlanar if F is not planar,
0089   //! -   ChFi2d_NoFace if F is a null face.
0090   Standard_EXPORT void Init (const TopoDS_Face& F);
0091 
0092   //! This initialize method allow to init the builder
0093   //! from a face RefFace and another face ModFace which derive from RefFace.
0094   //! This  is useful to modify a fillet or a chamfer already created on ModFace.
0095   Standard_EXPORT void Init (const TopoDS_Face& RefFace, const TopoDS_Face& ModFace);
0096 
0097   //! Adds a fillet of radius Radius between the two edges
0098   //! adjacent to the vertex V on the face modified by this
0099   //! algorithm. The two edges do not need to be rectilinear.
0100   //! This function returns the fillet and builds the resulting face.
0101   //! Warning
0102   //! The status of the construction, as given by the Status
0103   //! function, can be one of the following:
0104   //! - ChFi2d_IsDone if the fillet is built,
0105   //! - ChFi2d_ConnexionError if V does not belong to the initial face,
0106   //! -   ChFi2d_ComputationError if Radius is too large
0107   //! to build a fillet between the two adjacent edges,
0108   //! -   ChFi2d_NotAuthorized
0109   //! -   if one of the two edges connected to V is a fillet or chamfer, or
0110   //! -   if a curve other than a straight line or an arc of a
0111   //! circle is used as E, E1 or E2.
0112   //! Do not use the returned fillet if the status of the construction is not ChFi2d_IsDone.
0113   //! Exceptions
0114   //! Standard_NegativeValue if Radius is less than or equal to zero.
0115   Standard_EXPORT TopoDS_Edge AddFillet (const TopoDS_Vertex& V, const Standard_Real Radius);
0116   
0117   //! Assigns the radius Radius to the fillet Fillet already
0118   //! built on the face modified by this algorithm.
0119   //! This function returns the new fillet and modifies the existing face.
0120   //! Warning
0121   //! The status of the construction, as given by the Status
0122   //! function, can be one of the following:
0123   //! -   ChFi2d_IsDone if the new fillet is built,
0124   //! -   ChFi2d_ConnexionError if Fillet does not
0125   //! belong to the existing face,
0126   //! -   ChFi2d_ComputationError if Radius is too
0127   //! large to build a fillet between the two adjacent edges.
0128   //! Do not use the returned fillet if the status of the
0129   //! construction is not ChFi2d_IsDone.
0130   //! Exceptions
0131   //! Standard_NegativeValue if Radius is less than or equal to zero.
0132   Standard_EXPORT TopoDS_Edge ModifyFillet (const TopoDS_Edge& Fillet, const Standard_Real Radius);
0133   
0134   //! Removes the fillet Fillet already built on the face
0135   //! modified by this algorithm.
0136   //! This function returns the vertex connecting the two
0137   //! adjacent edges of Fillet and modifies the existing face.
0138   //! Warning
0139   //! -   The returned vertex is only valid if the Status
0140   //! function returns ChFi2d_IsDone.
0141   //! -   A null vertex is returned if the edge Fillet does not
0142   //! belong to the initial face.
0143   Standard_EXPORT TopoDS_Vertex RemoveFillet (const TopoDS_Edge& Fillet);
0144   
0145   //! Adds a chamfer on the face modified by this algorithm
0146   //! between the two adjacent edges E1 and E2, where
0147   //! the extremities of the chamfer are on E1 and E2 at
0148   //! distances D1 and D2 respectively
0149   //! In cases where the edges are not rectilinear, distances
0150   //! are measured using the curvilinear abscissa of the
0151   //! edges and the angle is measured with respect to the
0152   //! tangent at the corresponding point.
0153   //! The angle Ang is given in radians.
0154   //! This function returns the chamfer and builds the resulting face.
0155   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
0156   
0157   //! Adds a chamfer on the face modified by this algorithm
0158   //! between the two edges connected by the vertex V,
0159   //! where E is one of the two edges. The chamfer makes
0160   //! an angle Ang with E and one of its extremities is on
0161   //! E at distance D from V.
0162   //! In cases where the edges are not rectilinear, distances
0163   //! are measured using the curvilinear abscissa of the
0164   //! edges and the angle is measured with respect to the
0165   //! tangent at the corresponding point.
0166   //! The angle Ang is given in radians.
0167   //! This function returns the chamfer and builds the resulting face.
0168   //! Warning
0169   //! The status of the construction, as given by the Status function, can
0170   //! be one of the following:
0171   //! -          ChFi2d_IsDone if the chamfer is built,
0172   //! -  ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero,
0173   //! -          ChFi2d_ConnexionError if:
0174   //! - the edge E, E1 or E2 does not belong to the initial face, or
0175   //! -  the edges E1 and E2 are not adjacent, or
0176   //! -  the vertex V is not one of the limit points of the edge E,
0177   //! -          ChFi2d_ComputationError if the parameters of the chamfer
0178   //! are too large to build a chamfer between the two adjacent edges,
0179   //! -          ChFi2d_NotAuthorized if:
0180   //! - the edge E1, E2 or one of the two edges connected to V is a fillet or chamfer, or
0181   //! - a curve other than a straight line or an arc of a circle is used as E, E1 or E2.
0182   //! Do not use the returned chamfer if
0183   //! the status of the construction is not ChFi2d_IsDone.
0184   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang);
0185   
0186   //! Modifies the chamfer Chamfer on the face modified
0187   //! by this algorithm, where:
0188   //! E1 and E2 are the two adjacent edges on which
0189   //! Chamfer is already built; the extremities of the new
0190   //! chamfer are on E1 and E2 at distances D1 and D2 respectively.
0191   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
0192   
0193   //! Modifies the chamfer Chamfer on the face modified
0194   //! by this algorithm, where:
0195   //! E is one of the two adjacent edges on which
0196   //! Chamfer is already built; the new chamfer makes
0197   //! an angle Ang with E and one of its extremities is
0198   //! on E at distance D from the vertex on which the chamfer is built.
0199   //! In cases where the edges are not rectilinear, the
0200   //! distances are measured using the curvilinear abscissa
0201   //! of the edges and the angle is measured with respect
0202   //! to the tangent at the corresponding point.
0203   //! The angle Ang is given in radians.
0204   //! This function returns the new chamfer and modifies the existing face.
0205   //! Warning
0206   //! The status of the construction, as given by the Status
0207   //! function, can be one of the following:
0208   //! -   ChFi2d_IsDone if the chamfer is built,
0209   //! -   ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero,
0210   //! -   ChFi2d_ConnexionError if:
0211   //! -   the edge E, E1, E2 or Chamfer does not belong
0212   //! to the existing face, or
0213   //! -   the edges E1 and E2 are not adjacent,
0214   //! -   ChFi2d_ComputationError if the parameters of
0215   //! the chamfer are too large to build a chamfer
0216   //! between the two adjacent edges,
0217   //! -   ChFi2d_NotAuthorized if E1 or E2 is a fillet or chamfer.
0218   //! Do not use the returned chamfer if the status of the
0219   //! construction is not ChFi2d_IsDone.
0220   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang);
0221   
0222   //! Removes the chamfer Chamfer already built on the face
0223   //! modified by this algorithm.
0224   //! This function returns the vertex connecting the two
0225   //! adjacent edges of Chamfer and modifies the existing face.
0226   //! Warning
0227   //! -   The returned vertex is only valid if the Status
0228   //! function returns ChFi2d_IsDone.
0229   //! -   A null vertex is returned if the edge Chamfer does
0230   //! not belong to the initial face.
0231   Standard_EXPORT TopoDS_Vertex RemoveChamfer (const TopoDS_Edge& Chamfer);
0232   
0233   //! Returns true if the edge E on the face modified by this
0234   //! algorithm is chamfered or filleted.
0235   //! Warning
0236   //! Returns false if E does not belong to the face modified by this algorithm.
0237     Standard_Boolean IsModified (const TopoDS_Edge& E) const;
0238   
0239   //! Returns the table of fillets on the face modified by this algorithm.
0240     const TopTools_SequenceOfShape& FilletEdges() const;
0241   
0242   //! Returns the number of fillets on the face modified by this algorithm.
0243     Standard_Integer NbFillet() const;
0244   
0245   //! Returns the table of chamfers on the face modified by this algorithm.
0246     const TopTools_SequenceOfShape& ChamferEdges() const;
0247   
0248   //! Returns the number of chamfers on the face modified by this algorithm.
0249     Standard_Integer NbChamfer() const;
0250   
0251   //! Returns the list  of shapes modified from the shape
0252   //! <S>.
0253   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
0254   
0255   //! returns the number of new curves
0256   //! after the shape creation.
0257   Standard_EXPORT Standard_Integer NbCurves() const;
0258   
0259   //! Return the Edges created for curve I.
0260   Standard_EXPORT const TopTools_ListOfShape& NewEdges (const Standard_Integer I);
0261   
0262     Standard_Boolean HasDescendant (const TopoDS_Edge& E) const;
0263   
0264   //! Returns the chamfered or filleted edge built from the
0265   //! edge E on the face modified by this algorithm. If E has
0266   //! not been modified, this function returns E.
0267   //! Exceptions
0268   //! Standard_NoSuchObject if the edge E does not
0269   //! belong to the initial face.
0270     const TopoDS_Edge& DescendantEdge (const TopoDS_Edge& E) const;
0271   
0272   //! Returns the basis edge on the face modified by this
0273   //! algorithm from which the chamfered or filleted edge E is
0274   //! built. If E has not been modified, this function returns E.
0275   //! Warning
0276   //! E is returned if it does not belong to the initial face.
0277   Standard_EXPORT const TopoDS_Edge& BasisEdge (const TopoDS_Edge& E) const;
0278   
0279     ChFi2d_ConstructionError Status() const;
0280   
0281   //! Update the result and set the Done flag
0282   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0283 
0284 
0285 
0286 
0287 protected:
0288 
0289 
0290 
0291 
0292 
0293 private:
0294 
0295 
0296 
0297   ChFi2d_Builder myMakeChFi2d;
0298 
0299 
0300 };
0301 
0302 
0303 #include <BRepFilletAPI_MakeFillet2d.lxx>
0304 
0305 
0306 
0307 
0308 
0309 #endif // _BRepFilletAPI_MakeFillet2d_HeaderFile