0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepFilletAPI / BRepFilletAPI_MakeChamfer.cxx
CommitLineData
b311480e 1// Created on: 1995-06-22
2// Created by: Flore Lantheaume
3// Copyright (c) 1995-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
42cf5bc1 17
18#include <BRepFilletAPI_MakeChamfer.hxx>
7fd59977 19#include <ChFiDS_Spine.hxx>
20#include <TopExp_Explorer.hxx>
42cf5bc1 21#include <TopoDS_Edge.hxx>
22#include <TopoDS_Face.hxx>
23#include <TopoDS_Shape.hxx>
24#include <TopoDS_Vertex.hxx>
25#include <TopOpeBRepBuild_HBuilder.hxx>
26#include <TopOpeBRepDS_HDataStructure.hxx>
7fd59977 27
28//=======================================================================
29//function : BRepFilletAPI_MakeChamfer
30//purpose :
31//=======================================================================
32BRepFilletAPI_MakeChamfer::BRepFilletAPI_MakeChamfer(const TopoDS_Shape &S):myBuilder(S)
33{
34}
35
36
37
38//=======================================================================
39//function : Add
40//purpose :
41//=======================================================================
42
43void BRepFilletAPI_MakeChamfer::Add(const TopoDS_Edge &E )
44{
45 myBuilder.Add(E);
46}
47
48
49
50//=======================================================================
51//function : Add
52//purpose :
53//=======================================================================
54
55void BRepFilletAPI_MakeChamfer::Add(const Standard_Real Dis,
1d54b807 56 const TopoDS_Edge &E)
7fd59977 57{
1d54b807 58 myBuilder.Add(Dis, E);
7fd59977 59}
60
61
62//=======================================================================
63//function : SetDist
64//purpose :
65//=======================================================================
66
67void BRepFilletAPI_MakeChamfer::SetDist(const Standard_Real Dis,
68 const Standard_Integer IC,
69 const TopoDS_Face &F)
70{
71 myBuilder.SetDist(Dis, IC, F);
72}
73
74//=======================================================================
75//function : GetDist
76//purpose :
77//================================================================
78
79void BRepFilletAPI_MakeChamfer::GetDist(const Standard_Integer IC,
80 Standard_Real& Dis) const
81{
82 myBuilder.GetDist(IC, Dis);
83
84}
85
86//=======================================================================
87//function : Add
88//purpose :
89//=======================================================================
90
91void BRepFilletAPI_MakeChamfer::Add(const Standard_Real Dis1,
92 const Standard_Real Dis2,
93 const TopoDS_Edge &E,
94 const TopoDS_Face &F)
95{
96 myBuilder.Add(Dis1,Dis2,E,F);
97}
98
99
100//=======================================================================
101//function : SetDists
102//purpose :
103//=======================================================================
104
105void BRepFilletAPI_MakeChamfer::SetDists(const Standard_Real Dis1,
106 const Standard_Real Dis2,
107 const Standard_Integer IC,
108 const TopoDS_Face &F)
109{
110 myBuilder.SetDists(Dis1,Dis2,IC,F);
111}
112
113//=======================================================================
114//function : Dists
115//purpose :
116//================================================================
117
118void BRepFilletAPI_MakeChamfer::Dists(const Standard_Integer IC,
119 Standard_Real& Dis1,
120 Standard_Real& Dis2) const
121{
122 Standard_Real temp1, temp2;
123 myBuilder.Dists(IC,temp1,temp2);
124 Dis1 = temp1;
125 Dis2 = temp2;
126
127}
128
129
130//=======================================================================
131//function : Add
132//purpose :
133//=======================================================================
134
135void BRepFilletAPI_MakeChamfer::AddDA(const Standard_Real Dis,
136 const Standard_Real Angle,
137 const TopoDS_Edge &E,
138 const TopoDS_Face &F)
139{
140 myBuilder.AddDA(Dis, Angle, E, F);
141}
142
143//=======================================================================
144//function : SetDist
145//purpose :
146//=======================================================================
147
148void BRepFilletAPI_MakeChamfer::SetDistAngle(const Standard_Real Dis,
149 const Standard_Real Angle,
150 const Standard_Integer IC,
151 const TopoDS_Face &F)
152{
153 myBuilder.SetDistAngle(Dis, Angle, IC, F);
154}
155
156//=======================================================================
157//function : GetDistAngle
158//purpose :
159//================================================================
160
161void BRepFilletAPI_MakeChamfer::GetDistAngle(const Standard_Integer IC,
1d54b807 162 Standard_Real& Dis,
163 Standard_Real& Angle) const
7fd59977 164{
1d54b807 165 myBuilder.GetDistAngle(IC, Dis, Angle);
166}
167
168//=======================================================================
169//function : SetMode
170//purpose :
171//=======================================================================
7fd59977 172
1d54b807 173void BRepFilletAPI_MakeChamfer::SetMode(const ChFiDS_ChamfMode theMode)
174{
175 myBuilder.SetMode(theMode);
7fd59977 176}
177
178//=======================================================================
179//function : IsSymetric
180//purpose :
181//===============================================================
182
183Standard_Boolean BRepFilletAPI_MakeChamfer::IsSymetric(const Standard_Integer IC) const
184{
185 ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC);
186 Standard_Boolean ret = Standard_False;
187
188 if (ChamfMeth == ChFiDS_Sym) ret = Standard_True;
189
190 return ret;
191}
192
193
194//=======================================================================
195//function : IsTwoDistances
196//purpose :
197//===============================================================
198
199Standard_Boolean BRepFilletAPI_MakeChamfer::IsTwoDistances(const Standard_Integer IC) const
200{
201 ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC);
202 Standard_Boolean ret = Standard_False;
203
204 if (ChamfMeth == ChFiDS_TwoDist) ret = Standard_True;
205
206 return ret;
207}
208
209
210
211//=======================================================================
212//function : IsDistanceAngle
213//purpose :
214//===============================================================
215
216Standard_Boolean BRepFilletAPI_MakeChamfer::IsDistanceAngle(const Standard_Integer IC) const
217{
218 ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC);
219 Standard_Boolean ret = Standard_False;
220
221 if (ChamfMeth == ChFiDS_DistAngle) ret = Standard_True;
222
223 return ret;
224}
225
226
227
228//=======================================================================
229//function : ResetContour
230//purpose :
231//===============================================================
232
233void BRepFilletAPI_MakeChamfer::ResetContour(const Standard_Integer IC)
234{
235 myBuilder.ResetContour(IC);
236}
237
238
239//=======================================================================
240//function : NbContours
241//purpose :
242//=======================================================================
243
244Standard_Integer BRepFilletAPI_MakeChamfer::NbContours()const
245{
246 return myBuilder.NbElements();
247}
248
249
250
251//=======================================================================
252//function : Contour
253//purpose :
254//=======================================================================
255
256Standard_Integer BRepFilletAPI_MakeChamfer::Contour(const TopoDS_Edge &E)const
257{
258 return myBuilder.Contains(E);
259}
260
261
262
263//=======================================================================
264//function : NbEdges
265//purpose :
266//=======================================================================
267
268Standard_Integer BRepFilletAPI_MakeChamfer::NbEdges(const Standard_Integer I)const
269
270{
271 const Handle(ChFiDS_Spine)& Spine = myBuilder.Value(I);
272 return (Spine->NbEdges());
273}
274
275
276//=======================================================================
277//function : Edge
278//purpose :
279//=======================================================================
280
281const TopoDS_Edge& BRepFilletAPI_MakeChamfer::Edge(const Standard_Integer I,
282 const Standard_Integer J)const
283{
284 const Handle(ChFiDS_Spine)& Spine = myBuilder.Value(I);
285 const TopoDS_Edge& E = Spine->Edges(J);
286 return E;
287}
288
289//=======================================================================
290//function : Remove
291//purpose :
292//=======================================================================
293
294void BRepFilletAPI_MakeChamfer::Remove(const TopoDS_Edge& E)
295{
296 myBuilder.Remove(E);
297}
298
299//=======================================================================
300//function : Length
301//purpose :
302//=======================================================================
303
304Standard_Real BRepFilletAPI_MakeChamfer::Length(const Standard_Integer IC)const
305{
306 return myBuilder.Length(IC);
307}
308
309//=======================================================================
310//function : FirstVertex
311//purpose :
312//=======================================================================
313
314TopoDS_Vertex BRepFilletAPI_MakeChamfer::FirstVertex(const Standard_Integer IC)const
315{
316 return myBuilder.FirstVertex(IC);
317}
318
319
320//=======================================================================
321//function : LastVertex
322//purpose :
323//=======================================================================
324
325TopoDS_Vertex BRepFilletAPI_MakeChamfer::LastVertex(const Standard_Integer IC)const
326{
327 return myBuilder.LastVertex(IC);
328}
329
330
331//=======================================================================
332//function : Abscissa
333//purpose :
334//=======================================================================
335
336Standard_Real BRepFilletAPI_MakeChamfer::Abscissa(const Standard_Integer IC,
337 const TopoDS_Vertex& V)const
338{
339 return myBuilder.Abscissa(IC,V);
340}
341
342
343//=======================================================================
344//function : RelativeAbscissa
345//purpose :
346//=======================================================================
347
348Standard_Real BRepFilletAPI_MakeChamfer::RelativeAbscissa(const Standard_Integer IC,
349 const TopoDS_Vertex& V)const
350{
351 return myBuilder.RelativeAbscissa(IC,V);
352}
353
354//=======================================================================
355//function : ClosedAndTangent
356//purpose :
357//=======================================================================
358
359Standard_Boolean BRepFilletAPI_MakeChamfer::ClosedAndTangent
360(const Standard_Integer IC)const
361{
362 return myBuilder.ClosedAndTangent(IC);
363}
364
365
366//=======================================================================
367//function : Closed
368//purpose :
369//=======================================================================
370
371Standard_Boolean BRepFilletAPI_MakeChamfer::Closed
372(const Standard_Integer IC)const
373{
374 return myBuilder.Closed(IC);
375}
376
377//=======================================================================
378//function : Builder
379//purpose :
380//=======================================================================
381
382Handle(TopOpeBRepBuild_HBuilder) BRepFilletAPI_MakeChamfer::Builder()const
383{
384 return myBuilder.Builder();
385}
386
387//=======================================================================
388//function : Build
389//purpose :
390//=======================================================================
391
d03c0898 392void BRepFilletAPI_MakeChamfer::Build(const Message_ProgressRange& /*theRange*/)
7fd59977 393{
394 myBuilder.Compute();
395 if (myBuilder.IsDone()){
396 Done();
397 myShape = myBuilder.Shape();
398
399 //creation of the Map.
400 TopExp_Explorer ex;
401 for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) {
402 myMap.Add(ex.Current());
403 }
404 }
405}
406
407//=======================================================================
408//function : Reset
409//purpose :
410//=======================================================================
411
412void BRepFilletAPI_MakeChamfer::Reset()
413{
414 NotDone();
415 myBuilder.Reset();
416 myMap.Clear();
417}
418
419//=======================================================================
420//function : Generated
421//purpose :
422//=======================================================================
423
424const TopTools_ListOfShape& BRepFilletAPI_MakeChamfer::Generated
425 (const TopoDS_Shape& EorV)
426{
427 return myBuilder.Generated(EorV);
428}
429
430//=======================================================================
431//function : Modified
432//purpose :
433//=======================================================================
434
435const TopTools_ListOfShape& BRepFilletAPI_MakeChamfer::Modified
436 (const TopoDS_Shape& F)
437{
438 myGenerated.Clear();
439
440 if (myBuilder.Builder()->IsSplit(F, TopAbs_OUT)) {
441 TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_OUT));
442 for(;It.More();It.Next()) {
443 myGenerated.Append(It.Value());
444 }
445 }
446 if (myBuilder.Builder()->IsSplit(F, TopAbs_IN)) {
447 TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_IN));
448 for(;It.More();It.Next()) {
449 myGenerated.Append(It.Value());
450 }
451 }
452 if (myBuilder.Builder()->IsSplit(F, TopAbs_ON)) {
453 TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_ON));
454 for(;It.More();It.Next()) {
455 myGenerated.Append(It.Value());
456 }
457 }
458 return myGenerated;
459}
460
461//=======================================================================
462//function : IsDeleted
463//purpose :
464//=======================================================================
465
466Standard_Boolean BRepFilletAPI_MakeChamfer::IsDeleted(const TopoDS_Shape& F)
467{
468 if (myMap.Contains(F) ||
469 myBuilder.Builder()->IsSplit (F, TopAbs_OUT) ||
470 myBuilder.Builder()->IsSplit (F, TopAbs_IN) ||
471 myBuilder.Builder()->IsSplit (F, TopAbs_ON))
472 return Standard_False;
473
474 return Standard_True;
475}
476
477//=======================================================================
478//function : Simulate
479//purpose :
480//=======================================================================
481
482void BRepFilletAPI_MakeChamfer::Simulate(const Standard_Integer IC)
483{
484 myBuilder.Simulate(IC);
485}
486
487
488//=======================================================================
489//function : NbSurf
490//purpose :
491//=======================================================================
492
493Standard_Integer BRepFilletAPI_MakeChamfer::NbSurf(const Standard_Integer IC)const
494{
495 return myBuilder.NbSurf(IC);
496}
497
498
499//=======================================================================
500//function : Sect
501//purpose :
502//=======================================================================
503
504Handle(ChFiDS_SecHArray1) BRepFilletAPI_MakeChamfer::Sect(const Standard_Integer IC,
505 const Standard_Integer IS)const
506{
507 return myBuilder.Sect(IC, IS);
508}