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