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 | |
17 | #include <BRepOffsetAPI_MakePipeShell.ixx> |
18 | |
19 | #include <GeomFill_PipeError.hxx> |
20 | #include <Standard_NotImplemented.hxx> |
21 | #include <StdFail_NotDone.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : |
25 | //purpose : |
26 | //======================================================================= |
27 | BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine) |
28 | |
29 | |
30 | { |
31 | myPipe = new (BRepFill_PipeShell) (Spine); |
32 | SetTolerance(); |
33 | SetTransitionMode(); |
34 | NotDone(); |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : SetMode |
39 | //purpose : |
40 | //======================================================================= |
41 | void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet) |
42 | { |
43 | myPipe->Set(IsFrenet); |
44 | } |
45 | |
a31abc03 |
46 | //======================================================================= |
47 | //function : SetDiscreteMode |
48 | //purpose : |
49 | //======================================================================= |
50 | void BRepOffsetAPI_MakePipeShell::SetDiscreteMode() |
51 | { |
52 | myPipe->SetDiscrete(); |
53 | } |
54 | |
7fd59977 |
55 | //======================================================================= |
56 | //function : SetMode |
57 | //purpose : |
58 | //======================================================================= |
59 | void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe) |
60 | { |
61 | myPipe->Set(Axe); |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : SetMode |
66 | //purpose : |
67 | //======================================================================= |
68 | void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal) |
69 | { |
70 | myPipe->Set(BiNormal); |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : SetMode |
75 | //purpose : |
76 | //======================================================================= |
77 | Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport) |
78 | { |
79 | return myPipe->Set(SpineSupport); |
80 | } |
81 | |
82 | //======================================================================= |
83 | //function : SetMode |
84 | //purpose : |
85 | //======================================================================= |
86 | void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine, |
f9032cf2 |
87 | const Standard_Boolean CurvilinearEquivalence, |
88 | const BRepFill_TypeOfContact KeepContact) |
7fd59977 |
89 | { |
90 | myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact); |
91 | } |
92 | |
93 | //======================================================================= |
94 | //function :Add |
95 | //purpose : |
96 | //======================================================================= |
97 | void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile, |
98 | const Standard_Boolean WithContact, |
99 | const Standard_Boolean WithCorrection) |
100 | { |
101 | myPipe->Add(Profile, WithContact, WithCorrection); |
102 | } |
103 | |
104 | //======================================================================= |
105 | //function : Add |
106 | //purpose : |
107 | //======================================================================= |
108 | void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile, |
109 | const TopoDS_Vertex& Location, |
110 | const Standard_Boolean WithContact, |
111 | const Standard_Boolean WithCorrection) |
112 | { |
113 | myPipe->Add(Profile, Location, WithContact, WithCorrection); |
114 | } |
115 | |
116 | //======================================================================= |
117 | //function : SetLaw |
118 | //purpose : |
119 | //======================================================================= |
120 | void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile, |
121 | const Handle(Law_Function)& L, |
122 | const Standard_Boolean WithContact, |
123 | const Standard_Boolean WithCorrection) |
124 | { |
125 | myPipe->SetLaw(Profile, L, WithContact, WithCorrection); |
126 | } |
127 | |
128 | //======================================================================= |
129 | //function : SetLaw |
130 | //purpose : |
131 | //======================================================================= |
132 | void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile, |
133 | const Handle(Law_Function)& L, |
134 | const TopoDS_Vertex& Location, |
135 | const Standard_Boolean WithContact, |
136 | const Standard_Boolean WithCorrection) |
137 | { |
138 | myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection); |
139 | } |
140 | |
141 | //======================================================================= |
142 | //function : Delete |
143 | //purpose : |
144 | //======================================================================= |
145 | |
146 | void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile) |
147 | { |
148 | myPipe->Delete(Profile); |
149 | } |
150 | |
151 | |
152 | //======================================================================= |
153 | //function : IsReady |
154 | //purpose : |
155 | //======================================================================= |
156 | Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const |
157 | { |
158 | return myPipe->IsReady(); |
159 | } |
160 | |
161 | //======================================================================= |
162 | //function : GetStatus |
163 | //purpose : |
164 | //======================================================================= |
165 | BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const |
166 | { |
167 | BRepBuilderAPI_PipeError Status; |
168 | GeomFill_PipeError stat; |
169 | stat = myPipe->GetStatus(); |
170 | switch (stat) { |
171 | case GeomFill_PipeOk : |
172 | { |
173 | Status = BRepBuilderAPI_PipeDone; |
174 | break; |
175 | } |
176 | case GeomFill_PlaneNotIntersectGuide : |
177 | { |
178 | Status = BRepBuilderAPI_PlaneNotIntersectGuide; |
179 | break; |
180 | } |
181 | case GeomFill_ImpossibleContact : |
182 | { |
183 | Status = BRepBuilderAPI_ImpossibleContact; |
184 | break; |
185 | } |
186 | default : |
187 | Status = BRepBuilderAPI_PipeNotDone; |
188 | } |
189 | return Status; |
190 | } |
a31abc03 |
191 | |
7fd59977 |
192 | //======================================================================= |
a31abc03 |
193 | //function : SetTolerance |
7fd59977 |
194 | //purpose : |
195 | //======================================================================= |
196 | void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d, |
197 | const Standard_Real BoundTol, |
198 | const Standard_Real TolAngular) |
199 | { |
200 | myPipe->SetTolerance(Tol3d, BoundTol, TolAngular); |
201 | } |
202 | |
a31abc03 |
203 | //======================================================================= |
204 | //function : SetForceApproxC1 |
205 | //purpose : Set the flag that indicates attempt to approximate |
206 | // a C1-continuous surface if a swept surface proved |
207 | // to be C0. |
208 | //======================================================================= |
209 | void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1) |
210 | { |
211 | myPipe->SetForceApproxC1(ForceApproxC1); |
212 | } |
213 | |
7fd59977 |
214 | //======================================================================= |
215 | //function : SetTransitionMode |
216 | //purpose : |
217 | //======================================================================= |
218 | void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode) |
219 | { |
220 | myPipe->SetTransition( (BRepFill_TransitionStyle)Mode ); |
221 | } |
222 | |
223 | //======================================================================= |
224 | //function :Simulate |
225 | //purpose : |
226 | //======================================================================= |
227 | void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N, |
228 | TopTools_ListOfShape& R) |
229 | { |
230 | myPipe->Simulate(N, R); |
231 | } |
232 | |
233 | //======================================================================= |
234 | //function :Build() |
235 | //purpose : |
236 | //======================================================================= |
237 | void BRepOffsetAPI_MakePipeShell::Build() |
238 | { |
239 | Standard_Boolean Ok; |
240 | Ok = myPipe->Build(); |
241 | if (Ok) { |
242 | myShape = myPipe->Shape(); |
243 | Done(); |
244 | } |
245 | else NotDone(); |
246 | } |
247 | |
248 | //======================================================================= |
249 | //function : MakeSolid |
250 | //purpose : |
251 | //======================================================================= |
252 | Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid() |
253 | { |
254 | if (!IsDone()) StdFail_NotDone::Raise("BRepOffsetAPI_MakePipeShell::MakeSolid"); |
255 | Standard_Boolean Ok; |
256 | Ok = myPipe->MakeSolid(); |
257 | if (Ok) myShape = myPipe->Shape(); |
258 | return Ok; |
259 | } |
260 | |
261 | //======================================================================= |
262 | //function :FirstShape() |
263 | //purpose : |
264 | //======================================================================= |
265 | TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape() |
266 | { |
267 | return myPipe->FirstShape(); |
268 | } |
269 | |
270 | //======================================================================= |
271 | //function : LastShape() |
272 | //purpose : |
273 | //======================================================================= |
274 | TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape() |
275 | { |
276 | return myPipe->LastShape(); |
277 | } |
278 | |
279 | //======================================================================= |
280 | //function : Generated |
281 | //purpose : |
282 | //======================================================================= |
283 | const TopTools_ListOfShape& |
284 | BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S) |
285 | { |
286 | myPipe->Generated(S, myGenerated); |
287 | return myGenerated; |
288 | } |
289 | |