summaryrefslogtreecommitdiff
path: root/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx
blob: f9f420bcb61f35c1d6c54cb86a391de37add961e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// File:	BRepOffsetAPI_MakeOffsetShape.cxx
// Created:	Tue Feb 13 14:21:59 1996
// Author:	Yves FRICAUD
//		<yfr@stylox>


//  Modified by skv - Tue Mar 15 16:20:43 2005
// Add methods for supporting history.

#include <BRepOffsetAPI_MakeOffsetShape.ixx>
#include <BRepOffset_MakeOffset.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Standard_ConstructionError.hxx>
 
//=======================================================================
//function : BRepOffsetAPI_MakeOffsetShape
//purpose  : 
//=======================================================================

BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape()
{
}

//=======================================================================
//function : BRepOffsetAPI_MakeOffsetShape
//purpose  : 
//=======================================================================

BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape
(const TopoDS_Shape&    S, 
 const Standard_Real    Offset, 
 const Standard_Real    Tol, 
 const BRepOffset_Mode  Mode, 
 const Standard_Boolean Intersection,
 const Standard_Boolean SelfInter,
 const GeomAbs_JoinType Join)
{
  myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
  Build();
}


//=======================================================================
//function :MakeOffset
//purpose  : 
//=======================================================================

const BRepOffset_MakeOffset& BRepOffsetAPI_MakeOffsetShape::MakeOffset() const 
{
  return myOffsetShape;
}

//=======================================================================
//function : Build
//purpose  : 
//=======================================================================

void BRepOffsetAPI_MakeOffsetShape::Build()
{
  if (!IsDone()) {
    myOffsetShape.MakeOffsetShape();
    if (!myOffsetShape.IsDone()) return;
    myShape  = myOffsetShape.Shape();
    Done();
  }
}


//=======================================================================
//function : Generated
//purpose  : 
//=======================================================================

const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Generated (const TopoDS_Shape& S) 

{  
  myGenerated.Clear();
  if (!myOffsetShape.ClosingFaces().Contains(S)) {
    myOffsetShape.OffsetFacesFromShapes ().LastImage (S, myGenerated);
   
    if (!myOffsetShape.ClosingFaces().IsEmpty()) {
      // Reverse les Shape generes  dans le cas des solides minces.
      // Utile seulement pour les faces mais sans incidence sur les autres.
      TopTools_ListIteratorOfListOfShape it(myGenerated);
      for (; it.More(); it.Next())
	it.Value().Reverse();
    }
  }
  return myGenerated;
}


//  Modified by skv - Tue Mar 15 16:20:43 2005 Begin

//=======================================================================
//function : GeneratedEdge
//purpose  : 
//=======================================================================

const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::GeneratedEdge (const TopoDS_Shape& S) 

{  
  myGenerated.Clear();
  myOffsetShape.OffsetEdgesFromShapes ().LastImage (S, myGenerated);

  if (!myGenerated.IsEmpty()) {
    if (S.IsSame(myGenerated.First()))
      myGenerated.RemoveFirst();
  }

  return myGenerated;
}


//=======================================================================
//function : GetJoinType
//purpose  : Query offset join type.
//=======================================================================

GeomAbs_JoinType BRepOffsetAPI_MakeOffsetShape::GetJoinType() const
{
  return myOffsetShape.GetJoinType();
}

//  Modified by skv - Tue Mar 15 16:20:43 2005 End