b311480e |
1 | -- Created on: 1998-04-08 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1998-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | class MakePipeShell from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI |
24 | |
25 | ---Purpose: This class provides for a framework to construct a shell |
26 | -- or a solid along a spine consisting in a wire. |
27 | -- To produce a solid, the initial wire must be closed. |
28 | -- Two approaches are used: |
29 | -- - definition by section |
30 | -- - by a section and a scaling law |
31 | -- - by addition of successive intermediary sections |
32 | -- - definition by sweep mode. |
33 | -- - pseudo-Frenet |
34 | -- - constant |
35 | -- - binormal constant |
36 | -- - normal defined by a surface support |
37 | -- - normal defined by a guiding contour. |
38 | -- The two global approaches can also be combined. |
39 | -- You can also close the surface later in order to form a solid. |
40 | -- Warning: In this version some limitation exist |
41 | -- -- We can add only 1 Section (else Standard_NotImplemented is raised |
42 | -- -- Mode with auxilary spine is incompatible with hometetic laws |
43 | -- -- Mode with auxilary spine and keep contact produce only CO surface. |
44 | -- -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed> |
45 | -- Normaly all these limitations have to be deleted in mext version. |
46 | uses |
47 | Dir from gp, |
48 | Ax2 from gp, |
49 | Function from Law, |
50 | ListOfShape from TopTools, |
51 | Shape from TopoDS, |
52 | Wire from TopoDS, |
53 | Vertex from TopoDS, |
54 | TransitionMode from BRepBuilderAPI, |
55 | PipeError from BRepBuilderAPI, |
f9032cf2 |
56 | PipeShell from BRepFill, |
57 | TypeOfContact from BRepFill |
7fd59977 |
58 | |
59 | raises |
60 | DomainError from Standard, |
61 | NotDone from StdFail |
62 | |
63 | is |
64 | Create( Spine : Wire from TopoDS) |
65 | --- Purpose: Constructs the shell-generating framework defined by the wire Spine. |
66 | returns MakePipeShell from BRepOffsetAPI; |
67 | |
68 | ---Purpose: Sets an sweep's mode |
69 | -- If no mode are setted, the mode use in MakePipe is used |
70 | ---See Also: GeomFill_IsCorrectedFrenet |
71 | |
72 | SetMode(me : in out; IsFrenet : Boolean = Standard_False); |
73 | ---Purpose: Sets a Frenet or a CorrectedFrenet trihedron |
74 | -- to perform the sweeping |
75 | -- If IsFrenet is false, a corrected Frenet trihedron is used. |
76 | |
a31abc03 |
77 | SetDiscreteMode(me : in out); |
78 | ---Purpose: Sets a Discrete trihedron |
79 | -- to perform the sweeping |
80 | |
7fd59977 |
81 | SetMode(me : in out; Axe : Ax2 from gp); |
82 | ---Purpose: Sets a fixed trihedron to perform the sweeping |
83 | -- all sections will be parallel. |
84 | |
85 | |
86 | SetMode(me : in out; BiNormal : Dir from gp); |
87 | ---Purpose: Sets a fixed BiNormal direction to perform the -- |
88 | -- sweeping. Angular relations beetween the |
89 | -- section(s) and <BiNormal> will be constant |
90 | |
91 | |
92 | SetMode(me : in out; SpineSupport : Shape from TopoDS) |
93 | ---Purpose: Sets support to the spine to define the BiNormal of |
94 | -- the trihedron, like the normal to the surfaces. |
95 | -- Warning: To be effective, Each edge of the <spine> must |
96 | -- have an representaion on one face of<SpineSupport> |
97 | returns Boolean; |
98 | |
99 | SetMode(me : in out; |
100 | AuxiliarySpine : Wire from TopoDS; |
101 | CurvilinearEquivalence : Boolean; |
f9032cf2 |
102 | KeepContact : TypeOfContact from BRepFill = BRepFill_NoContact ); |
7fd59977 |
103 | |
104 | ---Purpose: Sets an auxiliary spine to define the Normal |
105 | -- For each Point of the Spine P, an Point Q is evalued |
106 | -- on <AuxiliarySpine> |
107 | -- If <CurvilinearEquivalence> |
108 | -- Q split <AuxiliarySpine> with the same length ratio |
109 | -- than P split <Spline>. |
110 | -- Else the plan define by P and the tangent to the <Spine> |
111 | -- intersect <AuxiliarySpine> in Q. |
112 | -- If <KeepContact> the Normal is defined to assume like the sweeped |
113 | -- section is in contact to the <AuxiliarySpine> |
114 | -- Else the Normal is defined by the vector PQ. |
115 | |
116 | ---Level: Public |
117 | |
a31abc03 |
118 | |
7fd59977 |
119 | -- ================================= |
120 | -- Methodes to define section(s) |
121 | -- ================================= |
122 | ---Purpose: Give section to sweep. |
123 | -- Possibilities are : |
124 | -- - Give one or sevral section |
125 | -- - Give one profile and an homotetic law. |
126 | -- - Automatic compute of correspondance beetween spine, and section |
127 | -- on the sweeped shape |
128 | -- - correspondance beetween spine, and section on the sweeped shape |
129 | -- defined by a vertex of the spine |
130 | |
131 | -- Option is : |
132 | -- -"WithContact" : The section is translated to be in |
133 | -- contact with the spine |
134 | |
135 | -- -"WithCorrection" The section is rotated to have a Normal -- |
136 | -- parallel to the trihedron's normal and have tangent |
137 | -- perpendicular to the trihedron's tangent. |
138 | |
139 | |
140 | Add(me:in out; |
141 | Profile : Shape from TopoDS; |
142 | WithContact : Boolean = Standard_False; |
143 | WithCorrection : Boolean = Standard_False ); |
144 | ---Purpose: Adds the section Profile to this framework. First and last |
145 | -- sections may be punctual, so the shape Profile may be |
146 | -- both wire and vertex. Correspondent point on spine is |
147 | -- computed automatically. |
148 | -- If WithContact is true, the section is translated to be in |
149 | -- contact with the spine. |
150 | -- If WithCorrection is true, the section is rotated to be |
151 | -- orthogonal to the spine?s tangent in the correspondent |
152 | -- point. This option has no sense if the section is punctual |
153 | -- (Profile is of type TopoDS_Vertex). |
154 | |
155 | Add(me:in out; |
156 | Profile : Shape from TopoDS; |
157 | Location : Vertex from TopoDS; |
158 | WithContact : Boolean = Standard_False; |
159 | WithCorrection : Boolean = Standard_False) |
160 | ---Purpose: Adds the section Profile to this framework. |
161 | -- Correspondent point on the spine is given by Location. |
162 | -- Warning: |
163 | -- To be effective, it is not recommended to combine methods Add and SetLaw. |
164 | raises DomainError; |
165 | |
166 | SetLaw(me :in out; |
167 | Profile : Shape from TopoDS; |
168 | L : Function from Law; |
169 | WithContact : Boolean = Standard_False; |
170 | WithCorrection : Boolean = Standard_False); |
171 | ---Purpose: Sets the evolution law defined by the wire Profile with |
172 | -- its position (Location, WithContact, WithCorrection |
173 | -- are the same options as in methods Add) and a |
174 | -- homotetic law defined by the function L. |
175 | -- Warning: |
176 | -- To be effective, it is not recommended to combine methods Add and SetLaw. |
177 | |
178 | |
179 | SetLaw(me :in out; |
180 | Profile : Shape from TopoDS; |
181 | L : Function from Law; |
182 | Location : Vertex from TopoDS; |
183 | WithContact : Boolean = Standard_False; |
184 | WithCorrection : Boolean = Standard_False); |
185 | ---Purpose: Sets the evolution law defined by the wire Profile with |
186 | -- its position (Location, WithContact, WithCorrection |
187 | -- are the same options as in methods Add) and a |
188 | -- homotetic law defined by the function L. |
189 | -- Warning: |
190 | -- To be effective, it is not recommended to combine methods Add and SetLaw. |
191 | |
192 | Delete(me : in out; Profile : Shape) ; |
193 | ---Purpose: Removes the section Profile from this framework. |
194 | |
195 | -- ======================================== |
196 | -- Methodes to perform and read shape |
197 | -- ======================================== |
198 | IsReady(me) |
199 | ---Purpose: Returns true if this tool object is ready to build the |
200 | -- shape, i.e. has a definition for the wire section Profile. |
201 | returns Boolean; |
202 | |
203 | GetStatus(me) |
204 | ---Purpose: Get a status, when Simulate or Build failed. It can be |
205 | -- BRepBuilderAPI_PipeDone, |
206 | -- BRepBuilderAPI_PipeNotDone, |
207 | -- BRepBuilderAPI_PlaneNotIntersectGuide, |
208 | -- BRepBuilderAPI_ImpossibleContact. |
209 | returns PipeError from BRepBuilderAPI; |
210 | |
211 | |
212 | SetTolerance(me : in out; |
213 | Tol3d : Real = 1.0e-4; |
214 | BoundTol : Real = 1.0e-4; |
215 | TolAngular : Real = 1.0e-2); |
216 | ---Purpose: Sets the following tolerance values |
217 | -- - 3D tolerance Tol3d |
218 | -- - boundary tolerance BoundTol |
219 | -- - angular tolerance TolAngular. |
220 | |
a31abc03 |
221 | SetForceApproxC1(me : in out; |
222 | ForceApproxC1 : Boolean from Standard); |
223 | ---Purpose: Set the flag that indicates attempt to approximate |
224 | -- a C1-continuous surface if a swept surface proved |
225 | -- to be C0. |
226 | |
7fd59977 |
227 | SetTransitionMode(me : in out; |
228 | Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed) |
229 | ---Purpose: Sets the transition mode to manage discontinuities on |
230 | -- the swept shape caused by fractures on the spine. The |
231 | -- transition mode can be BRepBuilderAPI_Transformed |
232 | -- (default value), BRepBuilderAPI_RightCorner, |
233 | -- BRepBuilderAPI_RoundCorner: |
234 | -- - RepBuilderAPI_Transformed: |
235 | -- discontinuities are treated by |
236 | -- modification of the sweeping mode. The |
237 | -- pipe is "transformed" at the fractures of |
238 | -- the spine. This mode assumes building a |
239 | -- self-intersected shell. |
240 | -- - BRepBuilderAPI_RightCorner: |
241 | -- discontinuities are treated like right |
242 | -- corner. Two pieces of the pipe |
243 | -- corresponding to two adjacent |
244 | -- segments of the spine are extended |
245 | -- and intersected at a fracture of the spine. |
246 | -- - BRepBuilderAPI_RoundCorner: |
247 | -- discontinuities are treated like round |
248 | -- corner. The corner is treated as rotation |
249 | -- of the profile around an axis which |
250 | -- passes through the point of the spine?s |
251 | -- fracture. This axis is based on cross |
252 | -- product of directions tangent to the |
253 | -- adjacent segments of the spine at their common point. |
254 | -- Warnings |
255 | -- The mode BRepBuilderAPI_RightCorner provides a |
256 | -- valid result if intersection of two pieces of the pipe |
257 | -- (corresponding to two adjacent segments of the spine) |
258 | -- in the neighborhood of the spine?s fracture is |
259 | -- connected and planar. This condition can be violated if |
260 | -- the spine is non-linear in some neighborhood of the |
261 | -- fracture or if the profile was set with a scaling law. |
262 | -- The last mode, BRepBuilderAPI_RoundCorner, will |
263 | -- assuredly provide a good result only if a profile was set |
264 | -- with option WithCorrection = True, i.e. it is strictly |
265 | -- orthogonal to the spine. |
266 | |
267 | is static; |
268 | |
269 | Simulate(me : in out; |
270 | NumberOfSection : Integer; |
271 | Result : out ListOfShape from TopTools) |
272 | ---Purpose: Simulates the resulting shape by calculating its |
273 | -- cross-sections. The spine is devided by this |
274 | -- cross-sections into (NumberOfSection - 1) equal |
275 | -- parts, the number of cross-sections is |
276 | -- NumberOfSection. The cross-sections are wires and |
277 | -- they are returned in the list Result. |
278 | -- This gives a rapid preview of the resulting shape, |
279 | -- which will be obtained using the settings you have provided. |
280 | -- Raises NotDone if <me> it is not Ready |
281 | raises NotDone; |
282 | |
283 | Build(me : in out) |
284 | ---Purpose: Builds the resulting shape (redefined from MakeShape). |
285 | ---Level: Public |
286 | raises NotDone -- If <me> it is not Ready |
287 | is redefined; |
288 | |
289 | MakeSolid(me : in out) |
290 | ---Purpose: Transforms the sweeping Shell in Solid. |
291 | -- If a propfile is not closed returns False |
292 | returns Boolean |
293 | raises NotDone; |
294 | |
295 | FirstShape (me : in out) |
296 | ---Purpose: Returns the TopoDS Shape of the bottom of the sweep. |
297 | returns Shape from TopoDS |
298 | is redefined; |
299 | |
300 | LastShape (me : in out) |
301 | ---Purpose: Returns the TopoDS Shape of the top of the sweep. |
302 | returns Shape from TopoDS |
303 | is redefined; |
304 | |
305 | Generated (me: in out; S : Shape from TopoDS) |
306 | ---Purpose: Returns a list of new shapes generated from the shape |
307 | -- S by the shell-generating algorithm. |
308 | -- This function is redefined from BRepOffsetAPI_MakeShape::Generated. |
309 | -- S can be an edge of the given Spine (see Constructor), |
310 | -- it can be an edge or a boundary vertex of a shape |
311 | -- returned by the method FirstShape(), it can also be a |
312 | -- Profile (see method Add()) closest to the beginning or |
313 | -- the end of the Spine. |
314 | -- If S is an edge of the given Spine, then method |
315 | -- Generated() returns a list of generated faces and a list |
316 | -- of edges from a free boundary (if it exists) of the |
317 | -- resulting shell. |
318 | -- If S is an edge of the start shape (see FirstShape()), |
319 | -- method Generated() returns a list of faces generated |
320 | -- along the whole spine from the given edge. |
321 | -- If S is a boundary vertex of the start shape (see |
322 | -- FirstShape()), method Generated() returns a list of |
323 | -- edges from the free boundary of the resulting shell, |
324 | -- generated along the whole spine. |
325 | -- If S is a Profile closest to the beginning of the Spine, |
326 | -- method Generated() returns the start shape, that can |
327 | -- also be obtained by method FirstShape(). |
328 | -- If S is a Profile closest to the end of the Spine, method |
329 | -- Generated() returns the end shape, that can also be |
330 | -- obtained by method LastShape(). |
331 | ---C++: return const & |
332 | returns ListOfShape from TopTools |
333 | is redefined; |
334 | |
335 | fields |
f9032cf2 |
336 | |
7fd59977 |
337 | myPipe : PipeShell from BRepFill; |
338 | |
339 | end MakePipeShell; |
340 | |
341 | |
342 | |