1 // Created on: 1993-10-14
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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.
17 // Modified by skv - Fri Mar 4 15:50:09 2005
18 // Add methods for supporting history.
20 #include <BRep_TEdge.hxx>
21 #include <BRepLib.hxx>
22 #include <BRepPrimAPI_MakeRevol.hxx>
23 #include <BRepSweep_Revol.hxx>
25 #include <TopExp_Explorer.hxx>
26 #include <TopoDS_Shape.hxx>
28 // perform checks on the argument
29 static const TopoDS_Shape& check(const TopoDS_Shape& S)
31 BRepLib::BuildCurves3d(S);
35 //=======================================================================
36 //function : BRepPrimAPI_MakeRevol
38 //=======================================================================
40 BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
42 const Standard_Real D,
43 const Standard_Boolean Copy) :
44 myRevol(check(S),A,D,Copy)
50 //=======================================================================
51 //function : BRepPrimAPI_MakeRevol
53 //=======================================================================
55 BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
57 const Standard_Boolean Copy) :
58 myRevol(check(S),A,Copy)
64 //=======================================================================
67 //=======================================================================
69 const BRepSweep_Revol& BRepPrimAPI_MakeRevol::Revol() const
75 //=======================================================================
78 //=======================================================================
80 void BRepPrimAPI_MakeRevol::Build()
82 myShape = myRevol.Shape();
84 // Modified by skv - Fri Mar 4 15:50:09 2005 Begin
85 myDegenerated.Clear();
87 TopExp_Explorer anExp(myShape, TopAbs_EDGE);
89 for (; anExp.More(); anExp.Next()) {
90 const TopoDS_Shape &anEdge = anExp.Current();
91 Handle(BRep_TEdge) aTEdge = Handle(BRep_TEdge)::DownCast(anEdge.TShape());
93 if (aTEdge->Degenerated())
94 myDegenerated.Append(anEdge);
96 // Modified by skv - Fri Mar 4 15:50:09 2005 End
100 //=======================================================================
101 //function : FirstShape
103 //=======================================================================
105 TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape()
107 return myRevol.FirstShape();
111 //=======================================================================
112 //function : LastShape
114 //=======================================================================
116 TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape()
118 return myRevol.LastShape();
122 //=======================================================================
123 //function : Generated
125 //=======================================================================
127 const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Generated (const TopoDS_Shape& S)
130 if (!myRevol.Shape (S).IsNull())
131 myGenerated.Append (myRevol.Shape (S));
136 // Modified by skv - Fri Mar 4 15:50:09 2005 Begin
138 //=======================================================================
139 //function : FirstShape
140 //purpose : This method returns the shape of the beginning of the revolution,
141 // generated with theShape (subShape of the generating shape).
142 //=======================================================================
144 TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape(const TopoDS_Shape &theShape)
146 return myRevol.FirstShape(theShape);
150 //=======================================================================
151 //function : LastShape
152 //purpose : This method returns the shape of the end of the revolution,
153 // generated with theShape (subShape of the generating shape).
154 //=======================================================================
156 TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape(const TopoDS_Shape &theShape)
158 return myRevol.LastShape(theShape);
161 //=======================================================================
162 //function : HasDegenerated
164 //=======================================================================
166 Standard_Boolean BRepPrimAPI_MakeRevol::HasDegenerated () const
168 return (!myDegenerated.IsEmpty());
172 //=======================================================================
173 //function : Degenerated
175 //=======================================================================
177 const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Degenerated () const
179 return myDegenerated;
181 // Modified by skv - Fri Mar 4 15:50:09 2005 End