b311480e |
1 | // Created on: 1998-04-08 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <BRepFill_PipeShell.hxx> |
19 | #include <BRepOffsetAPI_MakePipeShell.hxx> |
7fd59977 |
20 | #include <GeomFill_PipeError.hxx> |
42cf5bc1 |
21 | #include <gp_Ax2.hxx> |
22 | #include <gp_Dir.hxx> |
23 | #include <Law_Function.hxx> |
24 | #include <Standard_DomainError.hxx> |
7fd59977 |
25 | #include <Standard_NotImplemented.hxx> |
26 | #include <StdFail_NotDone.hxx> |
42cf5bc1 |
27 | #include <TopoDS_Shape.hxx> |
28 | #include <TopoDS_Vertex.hxx> |
29 | #include <TopoDS_Wire.hxx> |
7fd59977 |
30 | |
31 | //======================================================================= |
32 | //function : |
33 | //purpose : |
34 | //======================================================================= |
35 | BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine) |
36 | |
37 | |
38 | { |
39 | myPipe = new (BRepFill_PipeShell) (Spine); |
40 | SetTolerance(); |
41 | SetTransitionMode(); |
42 | NotDone(); |
43 | } |
44 | |
45 | //======================================================================= |
46 | //function : SetMode |
47 | //purpose : |
48 | //======================================================================= |
49 | void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet) |
50 | { |
51 | myPipe->Set(IsFrenet); |
52 | } |
53 | |
a31abc03 |
54 | //======================================================================= |
55 | //function : SetDiscreteMode |
56 | //purpose : |
57 | //======================================================================= |
58 | void BRepOffsetAPI_MakePipeShell::SetDiscreteMode() |
59 | { |
60 | myPipe->SetDiscrete(); |
61 | } |
62 | |
7fd59977 |
63 | //======================================================================= |
64 | //function : SetMode |
65 | //purpose : |
66 | //======================================================================= |
67 | void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe) |
68 | { |
69 | myPipe->Set(Axe); |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : SetMode |
74 | //purpose : |
75 | //======================================================================= |
76 | void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal) |
77 | { |
78 | myPipe->Set(BiNormal); |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : SetMode |
83 | //purpose : |
84 | //======================================================================= |
85 | Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport) |
86 | { |
87 | return myPipe->Set(SpineSupport); |
88 | } |
89 | |
90 | //======================================================================= |
91 | //function : SetMode |
92 | //purpose : |
93 | //======================================================================= |
94 | void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine, |
f9032cf2 |
95 | const Standard_Boolean CurvilinearEquivalence, |
96 | const BRepFill_TypeOfContact KeepContact) |
7fd59977 |
97 | { |
98 | myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact); |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function :Add |
103 | //purpose : |
104 | //======================================================================= |
105 | void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile, |
106 | const Standard_Boolean WithContact, |
107 | const Standard_Boolean WithCorrection) |
108 | { |
109 | myPipe->Add(Profile, WithContact, WithCorrection); |
110 | } |
111 | |
112 | //======================================================================= |
113 | //function : Add |
114 | //purpose : |
115 | //======================================================================= |
116 | void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile, |
117 | const TopoDS_Vertex& Location, |
118 | const Standard_Boolean WithContact, |
119 | const Standard_Boolean WithCorrection) |
120 | { |
121 | myPipe->Add(Profile, Location, WithContact, WithCorrection); |
122 | } |
123 | |
124 | //======================================================================= |
125 | //function : SetLaw |
126 | //purpose : |
127 | //======================================================================= |
128 | void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile, |
129 | const Handle(Law_Function)& L, |
130 | const Standard_Boolean WithContact, |
131 | const Standard_Boolean WithCorrection) |
132 | { |
133 | myPipe->SetLaw(Profile, L, WithContact, WithCorrection); |
134 | } |
135 | |
136 | //======================================================================= |
137 | //function : SetLaw |
138 | //purpose : |
139 | //======================================================================= |
140 | void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile, |
141 | const Handle(Law_Function)& L, |
142 | const TopoDS_Vertex& Location, |
143 | const Standard_Boolean WithContact, |
144 | const Standard_Boolean WithCorrection) |
145 | { |
146 | myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection); |
147 | } |
148 | |
149 | //======================================================================= |
150 | //function : Delete |
151 | //purpose : |
152 | //======================================================================= |
153 | |
154 | void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile) |
155 | { |
201c2208 |
156 | myPipe->DeleteProfile(Profile); |
7fd59977 |
157 | } |
158 | |
159 | |
160 | //======================================================================= |
161 | //function : IsReady |
162 | //purpose : |
163 | //======================================================================= |
164 | Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const |
165 | { |
166 | return myPipe->IsReady(); |
167 | } |
168 | |
169 | //======================================================================= |
170 | //function : GetStatus |
171 | //purpose : |
172 | //======================================================================= |
173 | BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const |
174 | { |
7fd59977 |
175 | GeomFill_PipeError stat; |
176 | stat = myPipe->GetStatus(); |
177 | switch (stat) { |
178 | case GeomFill_PipeOk : |
179 | { |
9fd2d2c3 |
180 | return BRepBuilderAPI_PipeDone; |
7fd59977 |
181 | } |
182 | case GeomFill_PlaneNotIntersectGuide : |
183 | { |
9fd2d2c3 |
184 | return BRepBuilderAPI_PlaneNotIntersectGuide; |
7fd59977 |
185 | } |
186 | case GeomFill_ImpossibleContact : |
187 | { |
9fd2d2c3 |
188 | return BRepBuilderAPI_ImpossibleContact; |
7fd59977 |
189 | } |
190 | default : |
9fd2d2c3 |
191 | return BRepBuilderAPI_PipeNotDone; |
7fd59977 |
192 | } |
7fd59977 |
193 | } |
a31abc03 |
194 | |
7fd59977 |
195 | //======================================================================= |
a31abc03 |
196 | //function : SetTolerance |
7fd59977 |
197 | //purpose : |
198 | //======================================================================= |
199 | void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d, |
200 | const Standard_Real BoundTol, |
201 | const Standard_Real TolAngular) |
202 | { |
203 | myPipe->SetTolerance(Tol3d, BoundTol, TolAngular); |
204 | } |
205 | |
e9216c6a |
206 | //======================================================================= |
207 | //function : SetMaxDegree |
208 | //purpose : |
209 | //======================================================================= |
210 | void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree) |
211 | { |
212 | myPipe->SetMaxDegree(NewMaxDegree); |
213 | } |
214 | |
215 | //======================================================================= |
216 | //function : SetMaxSegments |
217 | //purpose : |
218 | //======================================================================= |
219 | void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments) |
220 | { |
221 | myPipe->SetMaxSegments(NewMaxSegments); |
222 | } |
223 | |
a31abc03 |
224 | //======================================================================= |
225 | //function : SetForceApproxC1 |
226 | //purpose : Set the flag that indicates attempt to approximate |
227 | // a C1-continuous surface if a swept surface proved |
228 | // to be C0. |
229 | //======================================================================= |
230 | void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1) |
231 | { |
232 | myPipe->SetForceApproxC1(ForceApproxC1); |
233 | } |
234 | |
7fd59977 |
235 | //======================================================================= |
236 | //function : SetTransitionMode |
237 | //purpose : |
238 | //======================================================================= |
239 | void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode) |
240 | { |
241 | myPipe->SetTransition( (BRepFill_TransitionStyle)Mode ); |
242 | } |
243 | |
244 | //======================================================================= |
245 | //function :Simulate |
246 | //purpose : |
247 | //======================================================================= |
248 | void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N, |
249 | TopTools_ListOfShape& R) |
250 | { |
251 | myPipe->Simulate(N, R); |
252 | } |
253 | |
254 | //======================================================================= |
255 | //function :Build() |
256 | //purpose : |
257 | //======================================================================= |
258 | void BRepOffsetAPI_MakePipeShell::Build() |
259 | { |
260 | Standard_Boolean Ok; |
261 | Ok = myPipe->Build(); |
262 | if (Ok) { |
263 | myShape = myPipe->Shape(); |
264 | Done(); |
265 | } |
266 | else NotDone(); |
267 | } |
268 | |
269 | //======================================================================= |
270 | //function : MakeSolid |
271 | //purpose : |
272 | //======================================================================= |
273 | Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid() |
274 | { |
9775fa61 |
275 | if (!IsDone()) throw StdFail_NotDone("BRepOffsetAPI_MakePipeShell::MakeSolid"); |
7fd59977 |
276 | Standard_Boolean Ok; |
277 | Ok = myPipe->MakeSolid(); |
278 | if (Ok) myShape = myPipe->Shape(); |
279 | return Ok; |
280 | } |
281 | |
282 | //======================================================================= |
283 | //function :FirstShape() |
284 | //purpose : |
285 | //======================================================================= |
286 | TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape() |
287 | { |
288 | return myPipe->FirstShape(); |
289 | } |
290 | |
291 | //======================================================================= |
292 | //function : LastShape() |
293 | //purpose : |
294 | //======================================================================= |
295 | TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape() |
296 | { |
297 | return myPipe->LastShape(); |
298 | } |
299 | |
300 | //======================================================================= |
301 | //function : Generated |
302 | //purpose : |
303 | //======================================================================= |
304 | const TopTools_ListOfShape& |
305 | BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S) |
306 | { |
307 | myPipe->Generated(S, myGenerated); |
308 | return myGenerated; |
309 | } |
310 | |
73920cd4 |
311 | //======================================================================= |
312 | //function : ErrorOnSurface |
313 | //purpose : |
314 | //======================================================================= |
315 | |
316 | Standard_Real BRepOffsetAPI_MakePipeShell::ErrorOnSurface() const |
317 | { |
318 | return myPipe->ErrorOnSurface(); |
319 | } |