0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakePipeShell.cxx
CommitLineData
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//=======================================================================
35BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
7fd59977 36{
37 myPipe = new (BRepFill_PipeShell) (Spine);
38 SetTolerance();
39 SetTransitionMode();
40 NotDone();
41}
42
43//=======================================================================
44//function : SetMode
45//purpose :
46//=======================================================================
47 void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet)
48{
49 myPipe->Set(IsFrenet);
50}
51
a31abc03 52//=======================================================================
53//function : SetDiscreteMode
54//purpose :
55//=======================================================================
56 void BRepOffsetAPI_MakePipeShell::SetDiscreteMode()
57{
58 myPipe->SetDiscrete();
59}
60
7fd59977 61//=======================================================================
62//function : SetMode
63//purpose :
64//=======================================================================
65 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe)
66{
67 myPipe->Set(Axe);
68}
69
70//=======================================================================
71//function : SetMode
72//purpose :
73//=======================================================================
74 void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal)
75{
76 myPipe->Set(BiNormal);
77}
78
79//=======================================================================
80//function : SetMode
81//purpose :
82//=======================================================================
83 Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport)
84{
85 return myPipe->Set(SpineSupport);
86}
87
88//=======================================================================
89//function : SetMode
90//purpose :
91//=======================================================================
92 void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine,
f9032cf2 93 const Standard_Boolean CurvilinearEquivalence,
94 const BRepFill_TypeOfContact KeepContact)
7fd59977 95{
96 myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact);
97}
98
99//=======================================================================
100//function :Add
101//purpose :
102//=======================================================================
103 void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
104 const Standard_Boolean WithContact,
105 const Standard_Boolean WithCorrection)
106{
107 myPipe->Add(Profile, WithContact, WithCorrection);
108}
109
110//=======================================================================
111//function : Add
112//purpose :
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)
118{
119 myPipe->Add(Profile, Location, WithContact, WithCorrection);
120}
121
122//=======================================================================
123//function : SetLaw
124//purpose :
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)
130{
131 myPipe->SetLaw(Profile, L, WithContact, WithCorrection);
132}
133
134//=======================================================================
135//function : SetLaw
136//purpose :
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)
143{
144 myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection);
145}
146
147//=======================================================================
148//function : Delete
149//purpose :
150//=======================================================================
151
152void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
153{
201c2208 154 myPipe->DeleteProfile(Profile);
7fd59977 155}
156
157
158//=======================================================================
159//function : IsReady
160//purpose :
161//=======================================================================
162 Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const
163{
164 return myPipe->IsReady();
165}
166
167//=======================================================================
168//function : GetStatus
169//purpose :
170//=======================================================================
171 BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const
172{
7fd59977 173 GeomFill_PipeError stat;
174 stat = myPipe->GetStatus();
175 switch (stat) {
176 case GeomFill_PipeOk :
177 {
9fd2d2c3 178 return BRepBuilderAPI_PipeDone;
7fd59977 179 }
180 case GeomFill_PlaneNotIntersectGuide :
181 {
9fd2d2c3 182 return BRepBuilderAPI_PlaneNotIntersectGuide;
7fd59977 183 }
184 case GeomFill_ImpossibleContact :
185 {
9fd2d2c3 186 return BRepBuilderAPI_ImpossibleContact;
7fd59977 187 }
188 default :
9fd2d2c3 189 return BRepBuilderAPI_PipeNotDone;
7fd59977 190 }
7fd59977 191}
a31abc03 192
7fd59977 193//=======================================================================
a31abc03 194//function : SetTolerance
7fd59977 195//purpose :
196//=======================================================================
197 void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d,
198 const Standard_Real BoundTol,
199 const Standard_Real TolAngular)
200{
201 myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
202}
203
e9216c6a 204//=======================================================================
205//function : SetMaxDegree
206//purpose :
207//=======================================================================
208void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
209{
210 myPipe->SetMaxDegree(NewMaxDegree);
211}
212
213//=======================================================================
214//function : SetMaxSegments
215//purpose :
216//=======================================================================
217void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
218{
219 myPipe->SetMaxSegments(NewMaxSegments);
220}
221
a31abc03 222//=======================================================================
223//function : SetForceApproxC1
224//purpose : Set the flag that indicates attempt to approximate
225// a C1-continuous surface if a swept surface proved
226// to be C0.
227//=======================================================================
228 void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
229{
230 myPipe->SetForceApproxC1(ForceApproxC1);
231}
232
7fd59977 233//=======================================================================
234//function : SetTransitionMode
235//purpose :
236//=======================================================================
237 void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
238{
239 myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
240}
241
242//=======================================================================
243//function :Simulate
244//purpose :
245//=======================================================================
246 void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
247 TopTools_ListOfShape& R)
248{
249 myPipe->Simulate(N, R);
250}
251
252//=======================================================================
253//function :Build()
254//purpose :
255//=======================================================================
85843588 256 void BRepOffsetAPI_MakePipeShell::Build()
7fd59977 257{
258 Standard_Boolean Ok;
259 Ok = myPipe->Build();
260 if (Ok) {
261 myShape = myPipe->Shape();
262 Done();
263 }
264 else NotDone();
265}
266
267//=======================================================================
268//function : MakeSolid
269//purpose :
270//=======================================================================
271 Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid()
272{
9775fa61 273 if (!IsDone()) throw StdFail_NotDone("BRepOffsetAPI_MakePipeShell::MakeSolid");
7fd59977 274 Standard_Boolean Ok;
275 Ok = myPipe->MakeSolid();
276 if (Ok) myShape = myPipe->Shape();
277 return Ok;
278}
279
280//=======================================================================
281//function :FirstShape()
282//purpose :
283//=======================================================================
284 TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape()
285{
286 return myPipe->FirstShape();
287}
288
289//=======================================================================
290//function : LastShape()
291//purpose :
292//=======================================================================
293 TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape()
294{
295 return myPipe->LastShape();
296}
297
298//=======================================================================
299//function : Generated
300//purpose :
301//=======================================================================
302const TopTools_ListOfShape&
303BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S)
304{
305 myPipe->Generated(S, myGenerated);
306 return myGenerated;
307}
308
73920cd4 309//=======================================================================
310//function : ErrorOnSurface
311//purpose :
312//=======================================================================
313
314Standard_Real BRepOffsetAPI_MakePipeShell::ErrorOnSurface() const
315{
316 return myPipe->ErrorOnSurface();
317}