0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakePipeShell.hxx
CommitLineData
42cf5bc1 1// Created on: 1998-04-08
2// Created by: Philippe MANGIN
3// Copyright (c) 1998-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_MakePipeShell_HeaderFile
18#define _BRepOffsetAPI_MakePipeShell_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <BRepPrimAPI_MakeSweep.hxx>
25#include <Standard_Boolean.hxx>
26#include <BRepFill_TypeOfContact.hxx>
27#include <BRepBuilderAPI_PipeError.hxx>
28#include <Standard_Real.hxx>
29#include <Standard_Integer.hxx>
30#include <BRepBuilderAPI_TransitionMode.hxx>
31#include <TopTools_ListOfShape.hxx>
32class BRepFill_PipeShell;
33class Standard_DomainError;
34class StdFail_NotDone;
35class TopoDS_Wire;
36class gp_Ax2;
37class gp_Dir;
38class TopoDS_Shape;
39class TopoDS_Vertex;
40class Law_Function;
41
42
43//! This class provides for a framework to construct a shell
44//! or a solid along a spine consisting in a wire.
45//! To produce a solid, the initial wire must be closed.
46//! Two approaches are used:
47//! - definition by section
48//! - by a section and a scaling law
49//! - by addition of successive intermediary sections
50//! - definition by sweep mode.
51//! - pseudo-Frenet
52//! - constant
53//! - binormal constant
54//! - normal defined by a surface support
55//! - normal defined by a guiding contour.
56//! The two global approaches can also be combined.
57//! You can also close the surface later in order to form a solid.
58//! Warning: In this version some limitation exist
59//! -- We can add only 1 Section (else Standard_NotImplemented is raised
60//! -- Mode with auxilary spine is incompatible with hometetic laws
61//! -- Mode with auxilary spine and keep contact produce only CO surface.
62//! -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed>
63//! Normaly all these limitations have to be deleted in mext version.
64class BRepOffsetAPI_MakePipeShell : public BRepPrimAPI_MakeSweep
65{
66public:
67
68 DEFINE_STANDARD_ALLOC
69
70
71 //! Constructs the shell-generating framework defined by the wire Spine.
72 //! Sets an sweep's mode
73 //! If no mode are setted, the mode use in MakePipe is used
74 Standard_EXPORT BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine);
75
76 //! Sets a Frenet or a CorrectedFrenet trihedron
77 //! to perform the sweeping
78 //! If IsFrenet is false, a corrected Frenet trihedron is used.
79 Standard_EXPORT void SetMode (const Standard_Boolean IsFrenet = Standard_False);
80
81 //! Sets a Discrete trihedron
82 //! to perform the sweeping
83 Standard_EXPORT void SetDiscreteMode();
84
85 //! Sets a fixed trihedron to perform the sweeping
86 //! all sections will be parallel.
87 Standard_EXPORT void SetMode (const gp_Ax2& Axe);
88
89 //! Sets a fixed BiNormal direction to perform the --
90 //! sweeping. Angular relations beetween the
91 //! section(s) and <BiNormal> will be constant
92 Standard_EXPORT void SetMode (const gp_Dir& BiNormal);
93
94 //! Sets support to the spine to define the BiNormal of
95 //! the trihedron, like the normal to the surfaces.
96 //! Warning: To be effective, Each edge of the <spine> must
97 //! have an representaion on one face of<SpineSupport>
98 Standard_EXPORT Standard_Boolean SetMode (const TopoDS_Shape& SpineSupport);
99
100 //! Sets an auxiliary spine to define the Normal
101 //! For each Point of the Spine P, an Point Q is evalued
102 //! on <AuxiliarySpine>
103 //! If <CurvilinearEquivalence>
104 //! Q split <AuxiliarySpine> with the same length ratio
105 //! than P split <Spline>.
106 //! Else the plan define by P and the tangent to the <Spine>
107 //! intersect <AuxiliarySpine> in Q.
108 //! If <KeepContact> equals BRepFill_NoContact: The Normal is defined
109 //! by the vector PQ.
110 //! If <KeepContact> equals BRepFill_Contact: The Normal is defined to
111 //! achieve that the sweeped section is in contact to the
112 //! auxiliarySpine. The width of section is constant all along the path.
113 //! In other words, the auxiliary spine lies on the swept surface,
114 //! but not necessarily is a boundary of this surface. However,
115 //! the auxiliary spine has to be close enough to the main spine
116 //! to provide intersection with any section all along the path.
117 //! If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
118 //! becomes a boundary of the swept surface and the width of section varies
119 //! along the path.
120 //! Give section to sweep.
121 //! Possibilities are :
122 //! - Give one or sevral section
123 //! - Give one profile and an homotetic law.
124 //! - Automatic compute of correspondance beetween spine, and section
125 //! on the sweeped shape
126 //! - correspondance beetween spine, and section on the sweeped shape
127 //! defined by a vertex of the spine
128 Standard_EXPORT void SetMode (const TopoDS_Wire& AuxiliarySpine, const Standard_Boolean CurvilinearEquivalence, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact);
129
130 //! Adds the section Profile to this framework. First and last
131 //! sections may be punctual, so the shape Profile may be
132 //! both wire and vertex. Correspondent point on spine is
133 //! computed automatically.
134 //! If WithContact is true, the section is translated to be in
135 //! contact with the spine.
136 //! If WithCorrection is true, the section is rotated to be
137 //! orthogonal to the spine?s tangent in the correspondent
138 //! point. This option has no sense if the section is punctual
139 //! (Profile is of type TopoDS_Vertex).
140 Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
141
142 //! Adds the section Profile to this framework.
143 //! Correspondent point on the spine is given by Location.
144 //! Warning:
145 //! To be effective, it is not recommended to combine methods Add and SetLaw.
146 Standard_EXPORT void Add (const TopoDS_Shape& Profile, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
147
148 //! Sets the evolution law defined by the wire Profile with
149 //! its position (Location, WithContact, WithCorrection
150 //! are the same options as in methods Add) and a
151 //! homotetic law defined by the function L.
152 //! Warning:
153 //! To be effective, it is not recommended to combine methods Add and SetLaw.
154 Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
155
156 //! Sets the evolution law defined by the wire Profile with
157 //! its position (Location, WithContact, WithCorrection
158 //! are the same options as in methods Add) and a
159 //! homotetic law defined by the function L.
160 //! Warning:
161 //! To be effective, it is not recommended to combine methods Add and SetLaw.
162 Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
163
164 //! Removes the section Profile from this framework.
165 Standard_EXPORT void Delete (const TopoDS_Shape& Profile);
166
167 //! Returns true if this tool object is ready to build the
168 //! shape, i.e. has a definition for the wire section Profile.
169 Standard_EXPORT Standard_Boolean IsReady() const;
170
171 //! Get a status, when Simulate or Build failed. It can be
172 //! BRepBuilderAPI_PipeDone,
173 //! BRepBuilderAPI_PipeNotDone,
174 //! BRepBuilderAPI_PlaneNotIntersectGuide,
175 //! BRepBuilderAPI_ImpossibleContact.
176 Standard_EXPORT BRepBuilderAPI_PipeError GetStatus() const;
177
178 //! Sets the following tolerance values
179 //! - 3D tolerance Tol3d
180 //! - boundary tolerance BoundTol
181 //! - angular tolerance TolAngular.
182 Standard_EXPORT void SetTolerance (const Standard_Real Tol3d = 1.0e-4, const Standard_Real BoundTol = 1.0e-4, const Standard_Real TolAngular = 1.0e-2);
183
184 //! Define the maximum V degree of resulting surface
185 Standard_EXPORT void SetMaxDegree (const Standard_Integer NewMaxDegree);
186
187 //! Define the maximum number of spans in V-direction
188 //! on resulting surface
189 Standard_EXPORT void SetMaxSegments (const Standard_Integer NewMaxSegments);
190
191 //! Set the flag that indicates attempt to approximate
192 //! a C1-continuous surface if a swept surface proved
193 //! to be C0.
194 Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
195
196 //! Sets the transition mode to manage discontinuities on
197 //! the swept shape caused by fractures on the spine. The
198 //! transition mode can be BRepBuilderAPI_Transformed
199 //! (default value), BRepBuilderAPI_RightCorner,
200 //! BRepBuilderAPI_RoundCorner:
201 //! - RepBuilderAPI_Transformed:
202 //! discontinuities are treated by
203 //! modification of the sweeping mode. The
204 //! pipe is "transformed" at the fractures of
205 //! the spine. This mode assumes building a
206 //! self-intersected shell.
207 //! - BRepBuilderAPI_RightCorner:
208 //! discontinuities are treated like right
209 //! corner. Two pieces of the pipe
210 //! corresponding to two adjacent
211 //! segments of the spine are extended
212 //! and intersected at a fracture of the spine.
213 //! - BRepBuilderAPI_RoundCorner:
214 //! discontinuities are treated like round
215 //! corner. The corner is treated as rotation
216 //! of the profile around an axis which
217 //! passes through the point of the spine?s
218 //! fracture. This axis is based on cross
219 //! product of directions tangent to the
220 //! adjacent segments of the spine at their common point.
221 //! Warnings
222 //! The mode BRepBuilderAPI_RightCorner provides a
223 //! valid result if intersection of two pieces of the pipe
224 //! (corresponding to two adjacent segments of the spine)
225 //! in the neighborhood of the spine?s fracture is
226 //! connected and planar. This condition can be violated if
227 //! the spine is non-linear in some neighborhood of the
228 //! fracture or if the profile was set with a scaling law.
229 //! The last mode, BRepBuilderAPI_RoundCorner, will
230 //! assuredly provide a good result only if a profile was set
231 //! with option WithCorrection = True, i.e. it is strictly
232 //! orthogonal to the spine.
233 Standard_EXPORT void SetTransitionMode (const BRepBuilderAPI_TransitionMode Mode = BRepBuilderAPI_Transformed);
234
235 //! Simulates the resulting shape by calculating its
236 //! cross-sections. The spine is devided by this
237 //! cross-sections into (NumberOfSection - 1) equal
238 //! parts, the number of cross-sections is
239 //! NumberOfSection. The cross-sections are wires and
240 //! they are returned in the list Result.
241 //! This gives a rapid preview of the resulting shape,
242 //! which will be obtained using the settings you have provided.
243 //! Raises NotDone if <me> it is not Ready
244 Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Result);
245
246 //! Builds the resulting shape (redefined from MakeShape).
247 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
248
249 //! Transforms the sweeping Shell in Solid.
250 //! If a propfile is not closed returns False
251 Standard_EXPORT Standard_Boolean MakeSolid();
252
253 //! Returns the TopoDS Shape of the bottom of the sweep.
254 Standard_EXPORT virtual TopoDS_Shape FirstShape() Standard_OVERRIDE;
255
256 //! Returns the TopoDS Shape of the top of the sweep.
257 Standard_EXPORT virtual TopoDS_Shape LastShape() Standard_OVERRIDE;
258
259 //! Returns a list of new shapes generated from the shape
260 //! S by the shell-generating algorithm.
261 //! This function is redefined from BRepOffsetAPI_MakeShape::Generated.
262 //! S can be an edge of the given Spine (see Constructor),
263 //! it can be an edge or a boundary vertex of a shape
264 //! returned by the method FirstShape(), it can also be a
265 //! Profile (see method Add()) closest to the beginning or
266 //! the end of the Spine.
267 //! If S is an edge of the given Spine, then method
268 //! Generated() returns a list of generated faces and a list
269 //! of edges from a free boundary (if it exists) of the
270 //! resulting shell.
271 //! If S is an edge of the start shape (see FirstShape()),
272 //! method Generated() returns a list of faces generated
273 //! along the whole spine from the given edge.
274 //! If S is a boundary vertex of the start shape (see
275 //! FirstShape()), method Generated() returns a list of
276 //! edges from the free boundary of the resulting shell,
277 //! generated along the whole spine.
278 //! If S is a Profile closest to the beginning of the Spine,
279 //! method Generated() returns the start shape, that can
280 //! also be obtained by method FirstShape().
281 //! If S is a Profile closest to the end of the Spine, method
282 //! Generated() returns the end shape, that can also be
283 //! obtained by method LastShape().
284 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
285
286 Standard_EXPORT Standard_Real ErrorOnSurface() const;
287
288
289
290
291protected:
292
293
294
295
296
297private:
298
299
300
301 Handle(BRepFill_PipeShell) myPipe;
302
303
304};
305
306
307
308
309
310
311
312#endif // _BRepOffsetAPI_MakePipeShell_HeaderFile