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
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 class MakePipeShell from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI
19 ---Purpose: This class provides for a framework to construct a shell
20 -- or a solid along a spine consisting in a wire.
21 -- To produce a solid, the initial wire must be closed.
22 -- Two approaches are used:
23 -- - definition by section
24 -- - by a section and a scaling law
25 -- - by addition of successive intermediary sections
26 -- - definition by sweep mode.
29 -- - binormal constant
30 -- - normal defined by a surface support
31 -- - normal defined by a guiding contour.
32 -- The two global approaches can also be combined.
33 -- You can also close the surface later in order to form a solid.
34 -- Warning: In this version some limitation exist
35 -- -- We can add only 1 Section (else Standard_NotImplemented is raised
36 -- -- Mode with auxilary spine is incompatible with hometetic laws
37 -- -- Mode with auxilary spine and keep contact produce only CO surface.
38 -- -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed>
39 -- Normaly all these limitations have to be deleted in mext version.
44 ListOfShape from TopTools,
48 TransitionMode from BRepBuilderAPI,
49 PipeError from BRepBuilderAPI,
50 PipeShell from BRepFill,
51 TypeOfContact from BRepFill
54 DomainError from Standard,
58 Create( Spine : Wire from TopoDS)
59 --- Purpose: Constructs the shell-generating framework defined by the wire Spine.
60 returns MakePipeShell from BRepOffsetAPI;
62 ---Purpose: Sets an sweep's mode
63 -- If no mode are setted, the mode use in MakePipe is used
64 ---See Also: GeomFill_IsCorrectedFrenet
66 SetMode(me : in out; IsFrenet : Boolean = Standard_False);
67 ---Purpose: Sets a Frenet or a CorrectedFrenet trihedron
68 -- to perform the sweeping
69 -- If IsFrenet is false, a corrected Frenet trihedron is used.
71 SetDiscreteMode(me : in out);
72 ---Purpose: Sets a Discrete trihedron
73 -- to perform the sweeping
75 SetMode(me : in out; Axe : Ax2 from gp);
76 ---Purpose: Sets a fixed trihedron to perform the sweeping
77 -- all sections will be parallel.
80 SetMode(me : in out; BiNormal : Dir from gp);
81 ---Purpose: Sets a fixed BiNormal direction to perform the --
82 -- sweeping. Angular relations beetween the
83 -- section(s) and <BiNormal> will be constant
86 SetMode(me : in out; SpineSupport : Shape from TopoDS)
87 ---Purpose: Sets support to the spine to define the BiNormal of
88 -- the trihedron, like the normal to the surfaces.
89 -- Warning: To be effective, Each edge of the <spine> must
90 -- have an representaion on one face of<SpineSupport>
94 AuxiliarySpine : Wire from TopoDS;
95 CurvilinearEquivalence : Boolean;
96 KeepContact : TypeOfContact from BRepFill = BRepFill_NoContact );
98 ---Purpose: Sets an auxiliary spine to define the Normal
99 -- For each Point of the Spine P, an Point Q is evalued
100 -- on <AuxiliarySpine>
101 -- If <CurvilinearEquivalence>
102 -- Q split <AuxiliarySpine> with the same length ratio
103 -- than P split <Spline>.
104 -- Else the plan define by P and the tangent to the <Spine>
105 -- intersect <AuxiliarySpine> in Q.
106 -- If <KeepContact> equals BRepFill_NoContact: The Normal is defined
108 -- If <KeepContact> equals BRepFill_Contact: The Normal is defined to
109 -- achieve that the sweeped section is in contact to the
110 -- auxiliarySpine. The width of section is constant all along the path.
111 -- In other words, the auxiliary spine lies on the swept surface,
112 -- but not necessarily is a boundary of this surface. However,
113 -- the auxiliary spine has to be close enough to the main spine
114 -- to provide intersection with any section all along the path.
115 -- If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
116 -- becomes a boundary of the swept surface and the width of section varies
122 -- =================================
123 -- Methodes to define section(s)
124 -- =================================
125 ---Purpose: Give section to sweep.
126 -- Possibilities are :
127 -- - Give one or sevral section
128 -- - Give one profile and an homotetic law.
129 -- - Automatic compute of correspondance beetween spine, and section
130 -- on the sweeped shape
131 -- - correspondance beetween spine, and section on the sweeped shape
132 -- defined by a vertex of the spine
135 -- -"WithContact" : The section is translated to be in
136 -- contact with the spine
138 -- -"WithCorrection" The section is rotated to have a Normal --
139 -- parallel to the trihedron's normal and have tangent
140 -- perpendicular to the trihedron's tangent.
144 Profile : Shape from TopoDS;
145 WithContact : Boolean = Standard_False;
146 WithCorrection : Boolean = Standard_False );
147 ---Purpose: Adds the section Profile to this framework. First and last
148 -- sections may be punctual, so the shape Profile may be
149 -- both wire and vertex. Correspondent point on spine is
150 -- computed automatically.
151 -- If WithContact is true, the section is translated to be in
152 -- contact with the spine.
153 -- If WithCorrection is true, the section is rotated to be
154 -- orthogonal to the spine?s tangent in the correspondent
155 -- point. This option has no sense if the section is punctual
156 -- (Profile is of type TopoDS_Vertex).
159 Profile : Shape from TopoDS;
160 Location : Vertex from TopoDS;
161 WithContact : Boolean = Standard_False;
162 WithCorrection : Boolean = Standard_False)
163 ---Purpose: Adds the section Profile to this framework.
164 -- Correspondent point on the spine is given by Location.
166 -- To be effective, it is not recommended to combine methods Add and SetLaw.
170 Profile : Shape from TopoDS;
171 L : Function from Law;
172 WithContact : Boolean = Standard_False;
173 WithCorrection : Boolean = Standard_False);
174 ---Purpose: Sets the evolution law defined by the wire Profile with
175 -- its position (Location, WithContact, WithCorrection
176 -- are the same options as in methods Add) and a
177 -- homotetic law defined by the function L.
179 -- To be effective, it is not recommended to combine methods Add and SetLaw.
183 Profile : Shape from TopoDS;
184 L : Function from Law;
185 Location : Vertex from TopoDS;
186 WithContact : Boolean = Standard_False;
187 WithCorrection : Boolean = Standard_False);
188 ---Purpose: Sets the evolution law defined by the wire Profile with
189 -- its position (Location, WithContact, WithCorrection
190 -- are the same options as in methods Add) and a
191 -- homotetic law defined by the function L.
193 -- To be effective, it is not recommended to combine methods Add and SetLaw.
195 Delete(me : in out; Profile : Shape) ;
196 ---Purpose: Removes the section Profile from this framework.
198 -- ========================================
199 -- Methodes to perform and read shape
200 -- ========================================
202 ---Purpose: Returns true if this tool object is ready to build the
203 -- shape, i.e. has a definition for the wire section Profile.
207 ---Purpose: Get a status, when Simulate or Build failed. It can be
208 -- BRepBuilderAPI_PipeDone,
209 -- BRepBuilderAPI_PipeNotDone,
210 -- BRepBuilderAPI_PlaneNotIntersectGuide,
211 -- BRepBuilderAPI_ImpossibleContact.
212 returns PipeError from BRepBuilderAPI;
215 SetTolerance(me : in out;
216 Tol3d : Real = 1.0e-4;
217 BoundTol : Real = 1.0e-4;
218 TolAngular : Real = 1.0e-2);
219 ---Purpose: Sets the following tolerance values
220 -- - 3D tolerance Tol3d
221 -- - boundary tolerance BoundTol
222 -- - angular tolerance TolAngular.
224 SetForceApproxC1(me : in out;
225 ForceApproxC1 : Boolean from Standard);
226 ---Purpose: Set the flag that indicates attempt to approximate
227 -- a C1-continuous surface if a swept surface proved
230 SetTransitionMode(me : in out;
231 Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed)
232 ---Purpose: Sets the transition mode to manage discontinuities on
233 -- the swept shape caused by fractures on the spine. The
234 -- transition mode can be BRepBuilderAPI_Transformed
235 -- (default value), BRepBuilderAPI_RightCorner,
236 -- BRepBuilderAPI_RoundCorner:
237 -- - RepBuilderAPI_Transformed:
238 -- discontinuities are treated by
239 -- modification of the sweeping mode. The
240 -- pipe is "transformed" at the fractures of
241 -- the spine. This mode assumes building a
242 -- self-intersected shell.
243 -- - BRepBuilderAPI_RightCorner:
244 -- discontinuities are treated like right
245 -- corner. Two pieces of the pipe
246 -- corresponding to two adjacent
247 -- segments of the spine are extended
248 -- and intersected at a fracture of the spine.
249 -- - BRepBuilderAPI_RoundCorner:
250 -- discontinuities are treated like round
251 -- corner. The corner is treated as rotation
252 -- of the profile around an axis which
253 -- passes through the point of the spine?s
254 -- fracture. This axis is based on cross
255 -- product of directions tangent to the
256 -- adjacent segments of the spine at their common point.
258 -- The mode BRepBuilderAPI_RightCorner provides a
259 -- valid result if intersection of two pieces of the pipe
260 -- (corresponding to two adjacent segments of the spine)
261 -- in the neighborhood of the spine?s fracture is
262 -- connected and planar. This condition can be violated if
263 -- the spine is non-linear in some neighborhood of the
264 -- fracture or if the profile was set with a scaling law.
265 -- The last mode, BRepBuilderAPI_RoundCorner, will
266 -- assuredly provide a good result only if a profile was set
267 -- with option WithCorrection = True, i.e. it is strictly
268 -- orthogonal to the spine.
272 Simulate(me : in out;
273 NumberOfSection : Integer;
274 Result : out ListOfShape from TopTools)
275 ---Purpose: Simulates the resulting shape by calculating its
276 -- cross-sections. The spine is devided by this
277 -- cross-sections into (NumberOfSection - 1) equal
278 -- parts, the number of cross-sections is
279 -- NumberOfSection. The cross-sections are wires and
280 -- they are returned in the list Result.
281 -- This gives a rapid preview of the resulting shape,
282 -- which will be obtained using the settings you have provided.
283 -- Raises NotDone if <me> it is not Ready
287 ---Purpose: Builds the resulting shape (redefined from MakeShape).
289 raises NotDone -- If <me> it is not Ready
292 MakeSolid(me : in out)
293 ---Purpose: Transforms the sweeping Shell in Solid.
294 -- If a propfile is not closed returns False
298 FirstShape (me : in out)
299 ---Purpose: Returns the TopoDS Shape of the bottom of the sweep.
300 returns Shape from TopoDS
303 LastShape (me : in out)
304 ---Purpose: Returns the TopoDS Shape of the top of the sweep.
305 returns Shape from TopoDS
308 Generated (me: in out; S : Shape from TopoDS)
309 ---Purpose: Returns a list of new shapes generated from the shape
310 -- S by the shell-generating algorithm.
311 -- This function is redefined from BRepOffsetAPI_MakeShape::Generated.
312 -- S can be an edge of the given Spine (see Constructor),
313 -- it can be an edge or a boundary vertex of a shape
314 -- returned by the method FirstShape(), it can also be a
315 -- Profile (see method Add()) closest to the beginning or
316 -- the end of the Spine.
317 -- If S is an edge of the given Spine, then method
318 -- Generated() returns a list of generated faces and a list
319 -- of edges from a free boundary (if it exists) of the
321 -- If S is an edge of the start shape (see FirstShape()),
322 -- method Generated() returns a list of faces generated
323 -- along the whole spine from the given edge.
324 -- If S is a boundary vertex of the start shape (see
325 -- FirstShape()), method Generated() returns a list of
326 -- edges from the free boundary of the resulting shell,
327 -- generated along the whole spine.
328 -- If S is a Profile closest to the beginning of the Spine,
329 -- method Generated() returns the start shape, that can
330 -- also be obtained by method FirstShape().
331 -- If S is a Profile closest to the end of the Spine, method
332 -- Generated() returns the end shape, that can also be
333 -- obtained by method LastShape().
334 ---C++: return const &
335 returns ListOfShape from TopTools
340 myPipe : PipeShell from BRepFill;