Current MASTER is not built if OCCT_DEBUG macros is enabled
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_DraftAngle.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-02-22
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _BRepOffsetAPI_DraftAngle_HeaderFile
18#define _BRepOffsetAPI_DraftAngle_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TopTools_ListOfShape.hxx>
345d3056 25#include <TopTools_DataMapOfShapeShape.hxx>
42cf5bc1 26#include <BRepBuilderAPI_ModifyShape.hxx>
27#include <Standard_Real.hxx>
28#include <Standard_Boolean.hxx>
29#include <Draft_ErrorStatus.hxx>
30class StdFail_NotDone;
31class Standard_NullObject;
32class Standard_NoSuchObject;
33class Standard_ConstructionError;
34class TopoDS_Shape;
35class TopoDS_Face;
36class gp_Dir;
37class gp_Pln;
38
39
40//! Taper-adding transformations on a shape.
41//! The resulting shape is constructed by defining one face
42//! to be tapered after another one, as well as the
43//! geometric properties of their tapered transformation.
44//! Each tapered transformation is propagated along the
45//! series of faces which are tangential to one another and
46//! which contains the face to be tapered.
47//! This algorithm is useful in the construction of molds or
48//! dies. It facilitates the removal of the article being produced.
49//! A DraftAngle object provides a framework for:
50//! - initializing the construction algorithm with a given shape,
51//! - acquiring the data characterizing the faces to be tapered,
52//! - implementing the construction algorithm, and
53//! - consulting the results.
54//! Warning
55//! - This algorithm treats planar, cylindrical and conical faces.
56//! - Do not use shapes, which with a draft angle added to
57//! a face would modify the topology. This would, for
58//! example, involve creation of new vertices, edges or
59//! faces, or suppression of existing vertices, edges or faces.
60//! - Any face, which is continuous in tangency with the
61//! face to be tapered, will also be tapered. These
62//! connected faces must also respect the above criteria.
63class BRepOffsetAPI_DraftAngle : public BRepBuilderAPI_ModifyShape
64{
65public:
66
67 DEFINE_STANDARD_ALLOC
68
69
70 //! Constructs an empty algorithm to perform
71 //! taper-adding transformations on faces of a shape.
72 //! Use the Init function to define the shape to be tapered.
73 Standard_EXPORT BRepOffsetAPI_DraftAngle();
74
75 //! Initializes an algorithm to perform taper-adding
76 //! transformations on faces of the shape S.
77 //! S will be referred to as the initial shape of the algorithm.
78 Standard_EXPORT BRepOffsetAPI_DraftAngle(const TopoDS_Shape& S);
79
80 //! Cancels the results of all taper-adding transformations
81 //! performed by this algorithm on the initial shape. These
82 //! results will have been defined by successive calls to the function Add.
83 Standard_EXPORT void Clear();
84
85 //! Initializes, or reinitializes this taper-adding algorithm with the shape S.
86 //! S will be referred to as the initial shape of this algorithm.
87 Standard_EXPORT void Init (const TopoDS_Shape& S);
88
89 //! Adds the face F, the direction
90 //! Direction, the angle Angle, the plane NeutralPlane, and the flag
91 //! Flag to the framework created at construction time, and with this
92 //! data, defines the taper-adding transformation.
93 //! F is a face, which belongs to the initial shape of this algorithm or
94 //! to the shape loaded by the function Init.
95 //! Only planar, cylindrical or conical faces can be tapered:
96 //! - If the face F is planar, it is tapered by inclining it
97 //! through the angle Angle about the line of intersection between the
98 //! plane NeutralPlane and F.
99 //! Direction indicates the side of NeutralPlane from which matter is
100 //! removed if Angle is positive or added if Angle is negative.
101 //! - If F is cylindrical or conical, it is transformed in the
102 //! same way on a single face, resulting in a conical face if F
103 //! is cylindrical, and a conical or cylindrical face if it is already conical.
104 //! The taper-adding transformation is propagated from the face F along
105 //! the series of planar, cylindrical or conical faces containing F,
106 //! which are tangential to one another.
107 //! Use the function AddDone to check if this taper-adding transformation is successful.
108 //! Warning
109 //! Nothing is done if:
110 //! - the face F does not belong to the initial shape of this algorithm, or
111 //! - the face F is not planar, cylindrical or conical.
112 //! Exceptions
113 //! - Standard_NullObject if the initial shape is not
114 //! defined, i.e. if this algorithm has not been initialized
115 //! with the non-empty constructor or the Init function.
116 //! - Standard_ConstructionError if the previous call to
117 //! Add has failed. The function AddDone ought to have
118 //! been used to check for this, and the function Remove
119 //! to cancel the results of the unsuccessful taper-adding
120 //! transformation and to retrieve the previous shape.
121 Standard_EXPORT void Add (const TopoDS_Face& F, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane, const Standard_Boolean Flag = Standard_True);
122
123 //! Returns true if the previous taper-adding
124 //! transformation performed by this algorithm in the last
125 //! call to Add, was successful.
126 //! If AddDone returns false:
127 //! - the function ProblematicShape returns the face
128 //! on which the error occurred,
129 //! - the function Remove has to be used to cancel the
130 //! results of the unsuccessful taper-adding
131 //! transformation and to retrieve the previous shape.
132 //! Exceptions
133 //! Standard_NullObject if the initial shape has not
134 //! been defined, i.e. if this algorithm has not been
135 //! initialized with the non-empty constructor or the .Init function.
136 Standard_EXPORT Standard_Boolean AddDone() const;
137
138 //! Cancels the taper-adding transformation previously
139 //! performed by this algorithm on the face F and the
140 //! series of tangential faces which contain F, and retrieves
141 //! the shape before the last taper-adding transformation.
142 //! Warning
143 //! You will have to use this function if the previous call to
144 //! Add fails. Use the function AddDone to check it.
145 //! Exceptions
146 //! - Standard_NullObject if the initial shape has not
147 //! been defined, i.e. if this algorithm has not been
148 //! initialized with the non-empty constructor or the Init function.
149 //! - Standard_NoSuchObject if F has not been added
150 //! or has already been removed.
151 Standard_EXPORT void Remove (const TopoDS_Face& F);
152
153 //! Returns the shape on which an error occurred after an
154 //! unsuccessful call to Add or when IsDone returns false.
155 //! Exceptions
156 //! Standard_NullObject if the initial shape has not been
157 //! defined, i.e. if this algorithm has not been initialized with
158 //! the non-empty constructor or the Init function.
159 Standard_EXPORT const TopoDS_Shape& ProblematicShape() const;
160
161 //! Returns an error status when an error has occured
162 //! (Face, Edge or Vertex recomputaion problem).
163 //! Otherwise returns Draft_NoError. The method may be
164 //! called if AddDone returns Standard_False, or when
165 //! IsDone returns Standard_False.
166 Standard_EXPORT Draft_ErrorStatus Status() const;
167
168 //! Returns all the faces which have been added
169 //! together with the face <F>.
170 Standard_EXPORT const TopTools_ListOfShape& ConnectedFaces (const TopoDS_Face& F) const;
171
172 //! Returns all the faces on which a modification has
173 //! been given.
174 Standard_EXPORT const TopTools_ListOfShape& ModifiedFaces() const;
175
176 //! Builds the resulting shape (redefined from MakeShape).
177 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
178
179 Standard_EXPORT void CorrectWires();
180
181 //! Returns the list of shapes generated from the
182 //! shape <S>.
183 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
184
185 //! Returns the list of shapes modified from the shape
186 //! <S>.
187 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
188
345d3056 189 //! Returns the modified shape corresponding to <S>.
190 //! S can correspond to the entire initial shape or to its subshape.
191 //! Raises exceptions
192 //! Standard_NoSuchObject if S is not the initial shape or
193 //! a subshape of the initial shape to which the
194 //! transformation has been applied.
195 Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
196
42cf5bc1 197
198
199
200protected:
201
202
203
204
205
206private:
207
345d3056 208 Standard_EXPORT void CorrectVertexTol();
42cf5bc1 209
345d3056 210 TopTools_DataMapOfShapeShape myVtxToReplace;
42cf5bc1 211
212};
213
214
215
216
217
218
219
220#endif // _BRepOffsetAPI_DraftAngle_HeaderFile