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