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 : SetForceApproxC1
205 //purpose : Set the flag that indicates attempt to approximate
206 // a C1-continuous surface if a swept surface proved
208 //=======================================================================
209 void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
211 myPipe->SetForceApproxC1(ForceApproxC1);
214 //=======================================================================
215 //function : SetTransitionMode
217 //=======================================================================
218 void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
220 myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
223 //=======================================================================
226 //=======================================================================
227 void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
228 TopTools_ListOfShape& R)
230 myPipe->Simulate(N, R);
233 //=======================================================================
236 //=======================================================================
237 void BRepOffsetAPI_MakePipeShell::Build()
240 Ok = myPipe->Build();
242 myShape = myPipe->Shape();
248 //=======================================================================
249 //function : MakeSolid
251 //=======================================================================
252 Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid()
254 if (!IsDone()) StdFail_NotDone::Raise("BRepOffsetAPI_MakePipeShell::MakeSolid");
256 Ok = myPipe->MakeSolid();
257 if (Ok) myShape = myPipe->Shape();
261 //=======================================================================
262 //function :FirstShape()
264 //=======================================================================
265 TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape()
267 return myPipe->FirstShape();
270 //=======================================================================
271 //function : LastShape()
273 //=======================================================================
274 TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape()
276 return myPipe->LastShape();
279 //=======================================================================
280 //function : Generated
282 //=======================================================================
283 const TopTools_ListOfShape&
284 BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S)
286 myPipe->Generated(S, myGenerated);