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 #include <BRepOffsetAPI_MakePipeShell.ixx>
19 #include <GeomFill_PipeError.hxx>
20 #include <Standard_NotImplemented.hxx>
21 #include <StdFail_NotDone.hxx>
23 //=======================================================================
26 //=======================================================================
27 BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
31 myPipe = new (BRepFill_PipeShell) (Spine);
37 //=======================================================================
40 //=======================================================================
41 void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet)
43 myPipe->Set(IsFrenet);
46 //=======================================================================
47 //function : SetDiscreteMode
49 //=======================================================================
50 void BRepOffsetAPI_MakePipeShell::SetDiscreteMode()
52 myPipe->SetDiscrete();
55 //=======================================================================
58 //=======================================================================
59 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe)
64 //=======================================================================
67 //=======================================================================
68 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal)
70 myPipe->Set(BiNormal);
73 //=======================================================================
76 //=======================================================================
77 Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport)
79 return myPipe->Set(SpineSupport);
82 //=======================================================================
85 //=======================================================================
86 void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine,
87 const Standard_Boolean CurvilinearEquivalence,
88 const BRepFill_TypeOfContact KeepContact)
90 myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact);
93 //=======================================================================
96 //=======================================================================
97 void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
98 const Standard_Boolean WithContact,
99 const Standard_Boolean WithCorrection)
101 myPipe->Add(Profile, WithContact, WithCorrection);
104 //=======================================================================
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)
113 myPipe->Add(Profile, Location, WithContact, WithCorrection);
116 //=======================================================================
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)
125 myPipe->SetLaw(Profile, L, WithContact, WithCorrection);
128 //=======================================================================
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)
138 myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection);
141 //=======================================================================
144 //=======================================================================
146 void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
148 myPipe->Delete(Profile);
152 //=======================================================================
155 //=======================================================================
156 Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const
158 return myPipe->IsReady();
161 //=======================================================================
162 //function : GetStatus
164 //=======================================================================
165 BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const
167 BRepBuilderAPI_PipeError Status;
168 GeomFill_PipeError stat;
169 stat = myPipe->GetStatus();
171 case GeomFill_PipeOk :
173 Status = BRepBuilderAPI_PipeDone;
176 case GeomFill_PlaneNotIntersectGuide :
178 Status = BRepBuilderAPI_PlaneNotIntersectGuide;
181 case GeomFill_ImpossibleContact :
183 Status = BRepBuilderAPI_ImpossibleContact;
187 Status = BRepBuilderAPI_PipeNotDone;
192 //=======================================================================
193 //function : SetTolerance
195 //=======================================================================
196 void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d,
197 const Standard_Real BoundTol,
198 const Standard_Real TolAngular)
200 myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
203 //=======================================================================
204 //function : SetMaxDegree
206 //=======================================================================
207 void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
209 myPipe->SetMaxDegree(NewMaxDegree);
212 //=======================================================================
213 //function : SetMaxSegments
215 //=======================================================================
216 void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
218 myPipe->SetMaxSegments(NewMaxSegments);
221 //=======================================================================
222 //function : SetForceApproxC1
223 //purpose : Set the flag that indicates attempt to approximate
224 // a C1-continuous surface if a swept surface proved
226 //=======================================================================
227 void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
229 myPipe->SetForceApproxC1(ForceApproxC1);
232 //=======================================================================
233 //function : SetTransitionMode
235 //=======================================================================
236 void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
238 myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
241 //=======================================================================
244 //=======================================================================
245 void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
246 TopTools_ListOfShape& R)
248 myPipe->Simulate(N, R);
251 //=======================================================================
254 //=======================================================================
255 void BRepOffsetAPI_MakePipeShell::Build()
258 Ok = myPipe->Build();
260 myShape = myPipe->Shape();
266 //=======================================================================
267 //function : MakeSolid
269 //=======================================================================
270 Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid()
272 if (!IsDone()) StdFail_NotDone::Raise("BRepOffsetAPI_MakePipeShell::MakeSolid");
274 Ok = myPipe->MakeSolid();
275 if (Ok) myShape = myPipe->Shape();
279 //=======================================================================
280 //function :FirstShape()
282 //=======================================================================
283 TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape()
285 return myPipe->FirstShape();
288 //=======================================================================
289 //function : LastShape()
291 //=======================================================================
292 TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape()
294 return myPipe->LastShape();
297 //=======================================================================
298 //function : Generated
300 //=======================================================================
301 const TopTools_ListOfShape&
302 BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S)
304 myPipe->Generated(S, myGenerated);
308 //=======================================================================
309 //function : ErrorOnSurface
311 //=======================================================================
313 Standard_Real BRepOffsetAPI_MakePipeShell::ErrorOnSurface() const
315 return myPipe->ErrorOnSurface();