1 // Created on: 1995-06-22
2 // Created by: Flore Lantheaume
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepFilletAPI_MakeChamfer_HeaderFile
18 #define _BRepFilletAPI_MakeChamfer_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <ChFi3d_ChBuilder.hxx>
25 #include <TopTools_MapOfShape.hxx>
26 #include <BRepFilletAPI_LocalOperation.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <TopTools_ListOfShape.hxx>
31 #include <ChFiDS_SecHArray1.hxx>
32 class StdFail_NotDone;
37 class TopOpeBRepBuild_HBuilder;
40 //! Describes functions to build chamfers on edges of a shell or solid.
41 //! Chamfered Edge of a Shell or Solid
42 //! A MakeChamfer object provides a framework for:
43 //! - initializing the construction algorithm with a given shape,
44 //! - acquiring the data characterizing the chamfers,
45 //! - building the chamfers and constructing the resulting shape, and
46 //! - consulting the result.
47 class BRepFilletAPI_MakeChamfer : public BRepFilletAPI_LocalOperation
54 //! Initializes an algorithm for computing chamfers on the shape S.
55 //! The edges on which chamfers are built are defined using the Add function.
56 Standard_EXPORT BRepFilletAPI_MakeChamfer(const TopoDS_Shape& S);
58 //! Adds edge E to the table of edges used by this
59 //! algorithm to build chamfers, where the parameters
60 //! of the chamfer must be set after the
61 Standard_EXPORT void Add (const TopoDS_Edge& E) Standard_OVERRIDE;
63 //! Adds edge E to the table of edges used by this
64 //! algorithm to build chamfers, where
65 //! the parameters of the chamfer are given by
66 //! the distance Dis (symmetric chamfer).
67 //! The Add function results in a contour being built by
68 //! propagation from the edge E (i.e. the contour contains at
69 //! least this edge). This contour is composed of edges of
70 //! the shape which are tangential to one another and
71 //! which delimit two series of tangential faces, with one
72 //! series of faces being located on either side of the contour.
74 //! Nothing is done if edge E or the face F does not belong to the initial shape.
75 Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
77 //! Sets the distances Dis1 and Dis2 which give the
78 //! parameters of the chamfer along the contour of index
79 //! IC generated using the Add function in the internal
80 //! data structure of this algorithm. The face F identifies
81 //! the side where Dis1 is measured.
83 //! Nothing is done if either the edge E or the face F
84 //! does not belong to the initial shape.
85 Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
87 Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
89 //! Adds edge E to the table of edges used by this
90 //! algorithm to build chamfers, where
91 //! the parameters of the chamfer are given by the two
92 //! distances Dis1 and Dis2; the face F identifies the side
93 //! where Dis1 is measured.
94 //! The Add function results in a contour being built by
95 //! propagation from the edge E (i.e. the contour contains at
96 //! least this edge). This contour is composed of edges of
97 //! the shape which are tangential to one another and
98 //! which delimit two series of tangential faces, with one
99 //! series of faces being located on either side of the contour.
101 //! Nothing is done if edge E or the face F does not belong to the initial shape.
102 Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
104 //! Sets the distances Dis1 and Dis2 which give the
105 //! parameters of the chamfer along the contour of index
106 //! IC generated using the Add function in the internal
107 //! data structure of this algorithm. The face F identifies
108 //! the side where Dis1 is measured.
110 //! Nothing is done if either the edge E or the face F
111 //! does not belong to the initial shape.
112 Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
114 //! Returns the distances Dis1 and Dis2 which give the
115 //! parameters of the chamfer along the contour of index IC
116 //! in the internal data structure of this algorithm.
118 //! -1. is returned if IC is outside the bounds of the table of contours.
119 Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
121 //! Adds a fillet contour in the builder (builds a
122 //! contour of tangent edges to <E> and sets the
123 //! distance <Dis1> and angle <Angle> ( parameters of the chamfer ) ).
124 Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
126 //! set the distance <Dis> and <Angle> of the fillet
127 //! contour of index <IC> in the DS with <Dis> on <F>.
128 //! if the face <F> is not one of common faces
129 //! of an edge of the contour <IC>
130 Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
132 //! gives the distances <Dis> and <Angle> of the fillet
133 //! contour of index <IC> in the DS
134 Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle) const;
136 //! Sets the mode of chamfer
137 Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
139 //! return True if chamfer symetric false else.
140 Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
142 //! return True if chamfer is made with two distances false else.
143 Standard_EXPORT Standard_Boolean IsTwoDistances (const Standard_Integer IC) const;
145 //! return True if chamfer is made with distance and angle false else.
146 Standard_EXPORT Standard_Boolean IsDistanceAngle (const Standard_Integer IC) const;
148 //! Erases the chamfer parameters on the contour of
149 //! index IC in the internal data structure of this algorithm.
150 //! Use the SetDists function to reset this data.
152 //! Nothing is done if IC is outside the bounds of the table of contours.
153 Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE;
155 //! Returns the number of contours generated using the
156 //! Add function in the internal data structure of this algorithm.
157 Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE;
159 //! Returns the index of the contour in the internal data
160 //! structure of this algorithm, which contains the edge E of the shape.
161 //! This function returns 0 if the edge E does not belong to any contour.
163 //! This index can change if a contour is removed from the
164 //! internal data structure of this algorithm using the function Remove.
165 Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE;
167 //! Returns the number of edges in the contour of index I in
168 //! the internal data structure of this algorithm.
170 //! Returns 0 if I is outside the bounds of the table of contours.
171 Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE;
173 //! Returns the edge of index J in the contour of index I in
174 //! the internal data structure of this algorithm.
176 //! Returns a null shape if:
177 //! - I is outside the bounds of the table of contours, or
178 //! - J is outside the bounds of the table of edges of the contour of index I.
179 Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE;
181 //! Removes the contour in the internal data structure of
182 //! this algorithm which contains the edge E of the shape.
184 //! Nothing is done if the edge E does not belong to the
185 //! contour in the internal data structure of this algorithm.
186 Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE;
188 //! Returns the length of the contour of index IC in the
189 //! internal data structure of this algorithm.
191 //! Returns -1. if IC is outside the bounds of the table of contours.
192 Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE;
194 //! Returns the first vertex of the contour of index IC
195 //! in the internal data structure of this algorithm.
197 //! Returns a null shape if IC is outside the bounds of the table of contours.
198 Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE;
200 //! Returns the last vertex of the contour of index IC
201 //! in the internal data structure of this algorithm.
203 //! Returns a null shape if IC is outside the bounds of the table of contours.
204 Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE;
206 //! Returns the curvilinear abscissa of the vertex V on the
207 //! contour of index IC in the internal data structure of this algorithm.
210 //! - IC is outside the bounds of the table of contours, or
211 //! - V is not on the contour of index IC.
212 Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
214 //! Returns the relative curvilinear abscissa (i.e. between 0
215 //! and 1) of the vertex V on the contour of index IC in the
216 //! internal data structure of this algorithm.
219 //! - IC is outside the bounds of the table of contours, or
220 //! - V is not on the contour of index IC.
221 Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
223 //! eturns true if the contour of index IC in the internal
224 //! data structure of this algorithm is closed and tangential at the point of closure.
226 //! Returns false if IC is outside the bounds of the table of contours.
227 Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE;
229 //! Returns true if the contour of index IC in the internal
230 //! data structure of this algorithm is closed.
232 //! Returns false if IC is outside the bounds of the table of contours.
233 Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE;
235 //! Builds the chamfers on all the contours in the internal
236 //! data structure of this algorithm and constructs the resulting shape.
237 //! Use the function IsDone to verify that the chamfered
238 //! shape is built. Use the function Shape to retrieve the chamfered shape.
240 //! The construction of chamfers implements highly complex
241 //! construction algorithms. Consequently, there may be
242 //! instances where the algorithm fails, for example if the
243 //! data defining the parameters of the chamfer is not
244 //! compatible with the geometry of the initial shape. There
245 //! is no initial analysis of errors and these only become
246 //! evident at the construction stage.
247 //! Additionally, in the current software release, the following
248 //! cases are not handled:
249 //! - the end point of the contour is the point of
250 //! intersection of 4 or more edges of the shape, or
251 //! - the intersection of the chamfer with a face which
252 //! limits the contour is not fully contained in this face.
253 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
255 //! Reinitializes this algorithm, thus canceling the effects of the Build function.
256 //! This function allows modifications to be made to the
257 //! contours and chamfer parameters in order to rebuild the shape.
258 Standard_EXPORT void Reset() Standard_OVERRIDE;
260 //! Returns the internal filleting algorithm.
261 Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const;
263 //! Returns the list of shapes generated from the
265 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE;
267 //! Returns the list of shapes modified from the shape
269 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
271 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE;
273 Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE;
275 Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE;
277 Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE;
292 ChFi3d_ChBuilder myBuilder;
293 TopTools_MapOfShape myMap;
304 #endif // _BRepFilletAPI_MakeChamfer_HeaderFile