1 // Created on: 1996-02-13
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 // Modified by skv - Tue Mar 15 16:20:43 2005
24 // Add methods for supporting history.
26 #include <BRepOffsetAPI_MakeOffsetShape.ixx>
27 #include <BRepOffset_MakeOffset.hxx>
28 #include <TopTools_ListIteratorOfListOfShape.hxx>
29 #include <Standard_ConstructionError.hxx>
31 //=======================================================================
32 //function : BRepOffsetAPI_MakeOffsetShape
34 //=======================================================================
36 BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape()
40 //=======================================================================
41 //function : BRepOffsetAPI_MakeOffsetShape
43 //=======================================================================
45 BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape
46 (const TopoDS_Shape& S,
47 const Standard_Real Offset,
48 const Standard_Real Tol,
49 const BRepOffset_Mode Mode,
50 const Standard_Boolean Intersection,
51 const Standard_Boolean SelfInter,
52 const GeomAbs_JoinType Join)
54 myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
59 //=======================================================================
60 //function :MakeOffset
62 //=======================================================================
64 const BRepOffset_MakeOffset& BRepOffsetAPI_MakeOffsetShape::MakeOffset() const
69 //=======================================================================
72 //=======================================================================
74 void BRepOffsetAPI_MakeOffsetShape::Build()
77 myOffsetShape.MakeOffsetShape();
78 if (!myOffsetShape.IsDone()) return;
79 myShape = myOffsetShape.Shape();
85 //=======================================================================
86 //function : Generated
88 //=======================================================================
90 const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Generated (const TopoDS_Shape& S)
94 if (!myOffsetShape.ClosingFaces().Contains(S)) {
95 myOffsetShape.OffsetFacesFromShapes ().LastImage (S, myGenerated);
97 if (!myOffsetShape.ClosingFaces().IsEmpty()) {
98 // Reverse generated shapes in case of small solids.
99 // Useful only for faces without influence on others.
100 TopTools_ListIteratorOfListOfShape it(myGenerated);
101 for (; it.More(); it.Next())
102 it.Value().Reverse();
109 // Modified by skv - Tue Mar 15 16:20:43 2005 Begin
111 //=======================================================================
112 //function : GeneratedEdge
114 //=======================================================================
116 const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::GeneratedEdge (const TopoDS_Shape& S)
120 myOffsetShape.OffsetEdgesFromShapes ().LastImage (S, myGenerated);
122 if (!myGenerated.IsEmpty()) {
123 if (S.IsSame(myGenerated.First()))
124 myGenerated.RemoveFirst();
131 //=======================================================================
132 //function : GetJoinType
133 //purpose : Query offset join type.
134 //=======================================================================
136 GeomAbs_JoinType BRepOffsetAPI_MakeOffsetShape::GetJoinType() const
138 return myOffsetShape.GetJoinType();
141 // Modified by skv - Tue Mar 15 16:20:43 2005 End