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.
18 #include <BRepFill_PipeShell.hxx>
19 #include <BRepOffsetAPI_MakePipeShell.hxx>
20 #include <GeomFill_PipeError.hxx>
23 #include <Law_Function.hxx>
24 #include <Standard_DomainError.hxx>
25 #include <Standard_NotImplemented.hxx>
26 #include <StdFail_NotDone.hxx>
27 #include <TopoDS_Shape.hxx>
28 #include <TopoDS_Vertex.hxx>
29 #include <TopoDS_Wire.hxx>
31 //=======================================================================
34 //=======================================================================
35 BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
37 myPipe = new (BRepFill_PipeShell) (Spine);
43 //=======================================================================
46 //=======================================================================
47 void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet)
49 myPipe->Set(IsFrenet);
52 //=======================================================================
53 //function : SetDiscreteMode
55 //=======================================================================
56 void BRepOffsetAPI_MakePipeShell::SetDiscreteMode()
58 myPipe->SetDiscrete();
61 //=======================================================================
64 //=======================================================================
65 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe)
70 //=======================================================================
73 //=======================================================================
74 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal)
76 myPipe->Set(BiNormal);
79 //=======================================================================
82 //=======================================================================
83 Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport)
85 return myPipe->Set(SpineSupport);
88 //=======================================================================
91 //=======================================================================
92 void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine,
93 const Standard_Boolean CurvilinearEquivalence,
94 const BRepFill_TypeOfContact KeepContact)
96 myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact);
99 //=======================================================================
102 //=======================================================================
103 void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
104 const Standard_Boolean WithContact,
105 const Standard_Boolean WithCorrection)
107 myPipe->Add(Profile, WithContact, WithCorrection);
110 //=======================================================================
113 //=======================================================================
114 void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
115 const TopoDS_Vertex& Location,
116 const Standard_Boolean WithContact,
117 const Standard_Boolean WithCorrection)
119 myPipe->Add(Profile, Location, WithContact, WithCorrection);
122 //=======================================================================
125 //=======================================================================
126 void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
127 const Handle(Law_Function)& L,
128 const Standard_Boolean WithContact,
129 const Standard_Boolean WithCorrection)
131 myPipe->SetLaw(Profile, L, WithContact, WithCorrection);
134 //=======================================================================
137 //=======================================================================
138 void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
139 const Handle(Law_Function)& L,
140 const TopoDS_Vertex& Location,
141 const Standard_Boolean WithContact,
142 const Standard_Boolean WithCorrection)
144 myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection);
147 //=======================================================================
150 //=======================================================================
152 void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
154 myPipe->DeleteProfile(Profile);
158 //=======================================================================
161 //=======================================================================
162 Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const
164 return myPipe->IsReady();
167 //=======================================================================
168 //function : GetStatus
170 //=======================================================================
171 BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const
173 GeomFill_PipeError stat;
174 stat = myPipe->GetStatus();
176 case GeomFill_PipeOk :
178 return BRepBuilderAPI_PipeDone;
180 case GeomFill_PlaneNotIntersectGuide :
182 return BRepBuilderAPI_PlaneNotIntersectGuide;
184 case GeomFill_ImpossibleContact :
186 return BRepBuilderAPI_ImpossibleContact;
189 return BRepBuilderAPI_PipeNotDone;
193 //=======================================================================
194 //function : SetTolerance
196 //=======================================================================
197 void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d,
198 const Standard_Real BoundTol,
199 const Standard_Real TolAngular)
201 myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
204 //=======================================================================
205 //function : SetMaxDegree
207 //=======================================================================
208 void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
210 myPipe->SetMaxDegree(NewMaxDegree);
213 //=======================================================================
214 //function : SetMaxSegments
216 //=======================================================================
217 void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
219 myPipe->SetMaxSegments(NewMaxSegments);
222 //=======================================================================
223 //function : SetForceApproxC1
224 //purpose : Set the flag that indicates attempt to approximate
225 // a C1-continuous surface if a swept surface proved
227 //=======================================================================
228 void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
230 myPipe->SetForceApproxC1(ForceApproxC1);
233 //=======================================================================
234 //function : SetTransitionMode
236 //=======================================================================
237 void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
239 myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
242 //=======================================================================
245 //=======================================================================
246 void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
247 TopTools_ListOfShape& R)
249 myPipe->Simulate(N, R);
252 //=======================================================================
255 //=======================================================================
256 void BRepOffsetAPI_MakePipeShell::Build()
259 Ok = myPipe->Build();
261 myShape = myPipe->Shape();
267 //=======================================================================
268 //function : MakeSolid
270 //=======================================================================
271 Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid()
273 if (!IsDone()) throw StdFail_NotDone("BRepOffsetAPI_MakePipeShell::MakeSolid");
275 Ok = myPipe->MakeSolid();
276 if (Ok) myShape = myPipe->Shape();
280 //=======================================================================
281 //function :FirstShape()
283 //=======================================================================
284 TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape()
286 return myPipe->FirstShape();
289 //=======================================================================
290 //function : LastShape()
292 //=======================================================================
293 TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape()
295 return myPipe->LastShape();
298 //=======================================================================
299 //function : Generated
301 //=======================================================================
302 const TopTools_ListOfShape&
303 BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S)
305 myPipe->Generated(S, myGenerated);
309 //=======================================================================
310 //function : ErrorOnSurface
312 //=======================================================================
314 Standard_Real BRepOffsetAPI_MakePipeShell::ErrorOnSurface() const
316 return myPipe->ErrorOnSurface();