0023367: New functionality restoring the middle path of pipe-like shape
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakeThickSolid.cxx
CommitLineData
b311480e 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
5//
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.
10//
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.
13//
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.
20
7fd59977 21
22
23#include <BRepOffsetAPI_MakeThickSolid.ixx>
24#include <BRepOffset_MakeOffset.hxx>
25#include <Standard_ConstructionError.hxx>
26#include <TopTools_ListIteratorOfListOfShape.hxx>
27#include <TopoDS.hxx>
28
29
30//=======================================================================
31//function : BRepOffsetAPI_MakeThickSolid
32//purpose :
33//=======================================================================
34
35BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()
36{
37}
38
39
40//=======================================================================
41//function : BRepOffsetAPI_MakeThickSolid
42//purpose :
43//=======================================================================
44
45BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid
46(const TopoDS_Shape& S,
47 const TopTools_ListOfShape& ClosingFaces,
48 const Standard_Real Offset,
49 const Standard_Real Tol,
50 const BRepOffset_Mode Mode,
51 const Standard_Boolean Intersection,
52 const Standard_Boolean SelfInter,
53 const GeomAbs_JoinType Join)
54{
55 myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
56 TopTools_ListIteratorOfListOfShape it(ClosingFaces);
57 for (; it.More(); it.Next()) {
58 myOffsetShape.AddFace(TopoDS::Face(it.Value()));
59 }
60 Build();
61}
62
63//=======================================================================
64//function : virtual
65//purpose :
66//=======================================================================
67
68void BRepOffsetAPI_MakeThickSolid::Build()
69{
70 if (!IsDone()) {
71 myOffsetShape.MakeThickSolid();
72 if (!myOffsetShape.IsDone()) return;
73 myShape = myOffsetShape.Shape();
74 Done();
75 }
76}
77
78
79
80//=======================================================================
81//function : Modified
82//purpose :
83//=======================================================================
84
85const TopTools_ListOfShape& BRepOffsetAPI_MakeThickSolid::Modified (const TopoDS_Shape& F)
86
87{
88 myGenerated.Clear();
89 if (myOffsetShape.OffsetFacesFromShapes().HasImage(F)) {
90 if (myOffsetShape.ClosingFaces().Contains(F)) {
91 myOffsetShape.OffsetFacesFromShapes().LastImage (F, myGenerated);
92 // Les face du resultat sont orientees comme dans la piece initiale.
93 //si offset a l interieur.
94 TopTools_ListIteratorOfListOfShape it(myGenerated);
95 for (; it.More(); it.Next())
96 it.Value().Reverse();
97
98 }
99 }
100 return myGenerated;
101}