7fd59977 |
1 | // File: BRepPrimAPI_MakeRevol.cxx |
2 | // Created: Thu Oct 14 14:46:16 1993 |
3 | // Author: Remi LEQUETTE |
4 | // <rle@phylox> |
5 | |
6 | |
7 | // Modified by skv - Fri Mar 4 15:50:09 2005 |
8 | // Add methods for supporting history. |
9 | |
10 | #include <BRepPrimAPI_MakeRevol.ixx> |
11 | #include <BRepLib.hxx> |
12 | #include <TopExp_Explorer.hxx> |
13 | #include <BRep_TEdge.hxx> |
14 | |
15 | // perform checks on the argument |
16 | |
17 | static const TopoDS_Shape& check(const TopoDS_Shape& S) |
18 | { |
19 | BRepLib::BuildCurves3d(S); |
20 | return S; |
21 | } |
22 | |
23 | //======================================================================= |
24 | //function : BRepPrimAPI_MakeRevol |
25 | //purpose : |
26 | //======================================================================= |
27 | |
28 | BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S, |
29 | const gp_Ax1& A, |
30 | const Standard_Real D, |
31 | const Standard_Boolean Copy) : |
32 | myRevol(check(S),A,D,Copy) |
33 | { |
34 | Build(); |
35 | } |
36 | |
37 | |
38 | //======================================================================= |
39 | //function : BRepPrimAPI_MakeRevol |
40 | //purpose : |
41 | //======================================================================= |
42 | |
43 | BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S, |
44 | const gp_Ax1& A, |
45 | const Standard_Boolean Copy) : |
46 | myRevol(check(S),A,Copy) |
47 | { |
48 | Build(); |
49 | } |
50 | |
51 | |
52 | //======================================================================= |
53 | //function : Revol |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | const BRepSweep_Revol& BRepPrimAPI_MakeRevol::Revol() const |
58 | { |
59 | return myRevol; |
60 | } |
61 | |
62 | |
63 | //======================================================================= |
64 | //function : Build |
65 | //purpose : |
66 | //======================================================================= |
67 | |
68 | void BRepPrimAPI_MakeRevol::Build() |
69 | { |
70 | myShape = myRevol.Shape(); |
71 | Done(); |
72 | // Modified by skv - Fri Mar 4 15:50:09 2005 Begin |
73 | myDegenerated.Clear(); |
74 | |
75 | TopExp_Explorer anExp(myShape, TopAbs_EDGE); |
76 | |
77 | for (; anExp.More(); anExp.Next()) { |
78 | const TopoDS_Shape &anEdge = anExp.Current(); |
79 | Handle(BRep_TEdge) aTEdge = Handle(BRep_TEdge)::DownCast(anEdge.TShape()); |
80 | |
81 | if (aTEdge->Degenerated()) |
82 | myDegenerated.Append(anEdge); |
83 | } |
84 | // Modified by skv - Fri Mar 4 15:50:09 2005 End |
85 | } |
86 | |
87 | |
88 | //======================================================================= |
89 | //function : FirstShape |
90 | //purpose : |
91 | //======================================================================= |
92 | |
93 | TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape() |
94 | { |
95 | return myRevol.FirstShape(); |
96 | } |
97 | |
98 | |
99 | //======================================================================= |
100 | //function : LastShape |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape() |
105 | { |
106 | return myRevol.LastShape(); |
107 | } |
108 | |
109 | |
110 | //======================================================================= |
111 | //function : Generated |
112 | //purpose : |
113 | //======================================================================= |
114 | |
115 | const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Generated (const TopoDS_Shape& S) |
116 | { |
117 | myGenerated.Clear(); |
118 | if (!myRevol.Shape (S).IsNull()) |
119 | myGenerated.Append (myRevol.Shape (S)); |
120 | return myGenerated; |
121 | } |
122 | |
123 | |
124 | // Modified by skv - Fri Mar 4 15:50:09 2005 Begin |
125 | |
126 | //======================================================================= |
127 | //function : FirstShape |
128 | //purpose : This method returns the shape of the beginning of the revolution, |
129 | // generated with theShape (subShape of the generating shape). |
130 | //======================================================================= |
131 | |
132 | TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape(const TopoDS_Shape &theShape) |
133 | { |
134 | return myRevol.FirstShape(theShape); |
135 | } |
136 | |
137 | |
138 | //======================================================================= |
139 | //function : LastShape |
140 | //purpose : This method returns the shape of the end of the revolution, |
141 | // generated with theShape (subShape of the generating shape). |
142 | //======================================================================= |
143 | |
144 | TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape(const TopoDS_Shape &theShape) |
145 | { |
146 | return myRevol.LastShape(theShape); |
147 | } |
148 | |
149 | //======================================================================= |
150 | //function : HasDegenerated |
151 | //purpose : |
152 | //======================================================================= |
153 | |
154 | Standard_Boolean BRepPrimAPI_MakeRevol::HasDegenerated () const |
155 | { |
156 | return (!myDegenerated.IsEmpty()); |
157 | } |
158 | |
159 | |
160 | //======================================================================= |
161 | //function : Degenerated |
162 | //purpose : |
163 | //======================================================================= |
164 | |
165 | const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Degenerated () const |
166 | { |
167 | return myDegenerated; |
168 | } |
169 | // Modified by skv - Fri Mar 4 15:50:09 2005 End |