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 the two
66 //! distances Dis1 and Dis2; the face F identifies the side
67 //! where Dis1 is measured.
68 //! The Add function results in a contour being built by
69 //! propagation from the edge E (i.e. the contour contains at
70 //! least this edge). This contour is composed of edges of
71 //! the shape which are tangential to one another and
72 //! which delimit two series of tangential faces, with one
73 //! series of faces being located on either side of the contour.
75 //! Nothing is done if edge E or the face F does not belong to the initial shape.
76 Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E, const TopoDS_Face& F);
78 //! Sets the distances Dis1 and Dis2 which give the
79 //! parameters of the chamfer along the contour of index
80 //! IC generated using the Add function in the internal
81 //! data structure of this algorithm. The face F identifies
82 //! the side where Dis1 is measured.
84 //! Nothing is done if either the edge E or the face F
85 //! does not belong to the initial shape.
86 Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
88 Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
90 //! Adds a fillet contour in the builder (builds a
91 //! contour of tangent edges to <E> and sets the two
92 //! distances <Dis1> and <Dis2> ( parameters of the chamfer ) ).
93 Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
95 //! Sets the distances Dis1 and Dis2 which give the
96 //! parameters of the chamfer along the contour of index
97 //! IC generated using the Add function in the internal
98 //! data structure of this algorithm. The face F identifies
99 //! the side where Dis1 is measured.
101 //! Nothing is done if either the edge E or the face F
102 //! does not belong to the initial shape.
103 Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
105 //! Returns the distances Dis1 and Dis2 which give the
106 //! parameters of the chamfer along the contour of index IC
107 //! in the internal data structure of this algorithm.
109 //! -1. is returned if IC is outside the bounds of the table of contours.
110 Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
112 //! Adds a fillet contour in the builder (builds a
113 //! contour of tangent edges to <E> and sets the
114 //! distance <Dis1> and angle <Angle> ( parameters of the chamfer ) ).
115 Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
117 //! set the distance <Dis> and <Angle> of the fillet
118 //! contour of index <IC> in the DS with <Dis> on <F>.
119 //! if the face <F> is not one of common faces
120 //! of an edge of the contour <IC>
121 Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
123 //! gives the distances <Dis> and <Angle> of the fillet
124 //! contour of index <IC> in the DS
125 Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnFace1) const;
127 //! return True if chamfer symetric false else.
128 Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
130 //! return True if chamfer is made with two distances false else.
131 Standard_EXPORT Standard_Boolean IsTwoDistances (const Standard_Integer IC) const;
133 //! return True if chamfer is made with distance and angle false else.
134 Standard_EXPORT Standard_Boolean IsDistanceAngle (const Standard_Integer IC) const;
136 //! Erases the chamfer parameters on the contour of
137 //! index IC in the internal data structure of this algorithm.
138 //! Use the SetDists function to reset this data.
140 //! Nothing is done if IC is outside the bounds of the table of contours.
141 Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE;
143 //! Returns the number of contours generated using the
144 //! Add function in the internal data structure of this algorithm.
145 Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE;
147 //! Returns the index of the contour in the internal data
148 //! structure of this algorithm, which contains the edge E of the shape.
149 //! This function returns 0 if the edge E does not belong to any contour.
151 //! This index can change if a contour is removed from the
152 //! internal data structure of this algorithm using the function Remove.
153 Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE;
155 //! Returns the number of edges in the contour of index I in
156 //! the internal data structure of this algorithm.
158 //! Returns 0 if I is outside the bounds of the table of contours.
159 Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE;
161 //! Returns the edge of index J in the contour of index I in
162 //! the internal data structure of this algorithm.
164 //! Returns a null shape if:
165 //! - I is outside the bounds of the table of contours, or
166 //! - J is outside the bounds of the table of edges of the contour of index I.
167 Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE;
169 //! Removes the contour in the internal data structure of
170 //! this algorithm which contains the edge E of the shape.
172 //! Nothing is done if the edge E does not belong to the
173 //! contour in the internal data structure of this algorithm.
174 Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE;
176 //! Returns the length of the contour of index IC in the
177 //! internal data structure of this algorithm.
179 //! Returns -1. if IC is outside the bounds of the table of contours.
180 Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE;
182 //! Returns the first vertex of the contour of index IC
183 //! in the internal data structure of this algorithm.
185 //! Returns a null shape if IC is outside the bounds of the table of contours.
186 Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE;
188 //! Returns the last vertex of the contour of index IC
189 //! in the internal data structure of this algorithm.
191 //! Returns a null shape if IC is outside the bounds of the table of contours.
192 Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE;
194 //! Returns the curvilinear abscissa of the vertex V on the
195 //! contour of index IC in the internal data structure of this algorithm.
198 //! - IC is outside the bounds of the table of contours, or
199 //! - V is not on the contour of index IC.
200 Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
202 //! Returns the relative curvilinear abscissa (i.e. between 0
203 //! and 1) of the vertex V on the contour of index IC in the
204 //! internal data structure of this algorithm.
207 //! - IC is outside the bounds of the table of contours, or
208 //! - V is not on the contour of index IC.
209 Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
211 //! eturns true if the contour of index IC in the internal
212 //! data structure of this algorithm is closed and tangential at the point of closure.
214 //! Returns false if IC is outside the bounds of the table of contours.
215 Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE;
217 //! Returns true if the contour of index IC in the internal
218 //! data structure of this algorithm is closed.
220 //! Returns false if IC is outside the bounds of the table of contours.
221 Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE;
223 //! Builds the chamfers on all the contours in the internal
224 //! data structure of this algorithm and constructs the resulting shape.
225 //! Use the function IsDone to verify that the chamfered
226 //! shape is built. Use the function Shape to retrieve the chamfered shape.
228 //! The construction of chamfers implements highly complex
229 //! construction algorithms. Consequently, there may be
230 //! instances where the algorithm fails, for example if the
231 //! data defining the parameters of the chamfer is not
232 //! compatible with the geometry of the initial shape. There
233 //! is no initial analysis of errors and these only become
234 //! evident at the construction stage.
235 //! Additionally, in the current software release, the following
236 //! cases are not handled:
237 //! - the end point of the contour is the point of
238 //! intersection of 4 or more edges of the shape, or
239 //! - the intersection of the chamfer with a face which
240 //! limits the contour is not fully contained in this face.
241 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
243 //! Reinitializes this algorithm, thus canceling the effects of the Build function.
244 //! This function allows modifications to be made to the
245 //! contours and chamfer parameters in order to rebuild the shape.
246 Standard_EXPORT void Reset() Standard_OVERRIDE;
248 //! Returns the internal filleting algorithm.
249 Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const;
251 //! Returns the list of shapes generated from the
253 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE;
255 //! Returns the list of shapes modified from the shape
257 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
259 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE;
261 Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE;
263 Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE;
265 Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE;
280 ChFi3d_ChBuilder myBuilder;
281 TopTools_MapOfShape myMap;
292 #endif // _BRepFilletAPI_MakeChamfer_HeaderFile