b311480e |
1 | // Created on: 1994-07-12 |
2 | // Created by: Bruno DUMORTIER |
3 | // Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #include <BRepOffsetAPI_MakePipe.ixx> |
18 | |
19 | #include <TopExp_Explorer.hxx> |
20 | #include <TopoDS_Face.hxx> |
21 | #include <TopoDS_Edge.hxx> |
22 | #include <TopoDS_Vertex.hxx> |
23 | #include <TopoDS.hxx> |
24 | #include <TopAbs_ShapeEnum.hxx> |
73920cd4 |
25 | #include <TopTools_IndexedMapOfShape.hxx> |
26 | #include <TopExp.hxx> |
7fd59977 |
27 | |
28 | //======================================================================= |
29 | //function : BRepOffsetAPI_MakePipe |
471ce736 |
30 | //purpose : constructor |
7fd59977 |
31 | //======================================================================= |
32 | |
33 | BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine , |
471ce736 |
34 | const TopoDS_Shape& Profile) |
7fd59977 |
35 | : myPipe(Spine, Profile) |
36 | { |
37 | Build(); |
38 | } |
39 | |
a31abc03 |
40 | //======================================================================= |
471ce736 |
41 | //function : BRepOffsetAPI_MakePipe |
42 | //purpose : constructor |
43 | // Set the mode of sweeping |
a31abc03 |
44 | // It can be: |
45 | // - Frenet |
46 | // - Corrected Frenet |
47 | // - Discrete Trihedron |
471ce736 |
48 | // Also set the flag that indicates attempt to approximate |
a31abc03 |
49 | // a C1-continuous surface if a swept surface proved |
50 | // to be C0. |
51 | //======================================================================= |
52 | |
471ce736 |
53 | BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine , |
54 | const TopoDS_Shape& Profile, |
55 | const GeomFill_Trihedron aMode, |
56 | const Standard_Boolean ForceApproxC1) |
57 | : myPipe(Spine, Profile, aMode, ForceApproxC1) |
a31abc03 |
58 | { |
471ce736 |
59 | Build(); |
a31abc03 |
60 | } |
61 | |
7fd59977 |
62 | //======================================================================= |
63 | //function : Pipe |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | const BRepFill_Pipe& BRepOffsetAPI_MakePipe::Pipe() const |
68 | { |
69 | return myPipe; |
70 | } |
71 | |
72 | |
73 | //======================================================================= |
74 | //function : Build |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | void BRepOffsetAPI_MakePipe::Build() |
79 | { |
80 | myShape = myPipe.Shape(); |
73920cd4 |
81 | //Check for emptiness of result |
82 | TopTools_IndexedMapOfShape theMap; |
83 | TopExp::MapShapes(myShape, theMap); |
84 | if (theMap.Extent() == 1) |
85 | NotDone(); |
86 | else |
87 | Done(); |
7fd59977 |
88 | } |
89 | |
90 | |
91 | //======================================================================= |
92 | //function : FirstShape |
93 | //purpose : |
94 | //======================================================================= |
95 | |
96 | TopoDS_Shape BRepOffsetAPI_MakePipe::FirstShape() |
97 | { |
98 | return myPipe.FirstShape(); |
99 | } |
100 | |
101 | |
102 | //======================================================================= |
103 | //function : LastShape |
104 | //purpose : |
105 | //======================================================================= |
106 | |
107 | TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape() |
108 | { |
109 | return myPipe.LastShape(); |
110 | } |
111 | |
112 | |
113 | //======================================================================= |
114 | //function : Generated |
115 | //purpose : |
116 | //======================================================================= |
117 | |
118 | TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine, |
119 | const TopoDS_Shape& SProfile) |
120 | { |
121 | if (SProfile.ShapeType () == TopAbs_EDGE) { |
122 | return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile)); |
123 | } |
124 | else if (SProfile.ShapeType () == TopAbs_VERTEX) { |
125 | return myPipe.Edge (TopoDS::Edge (SSpine), TopoDS::Vertex (SProfile)); |
126 | } |
127 | |
128 | //POP pour NT |
129 | TopoDS_Shape bid; |
130 | return bid; |
131 | } |
132 | |
73920cd4 |
133 | //======================================================================= |
134 | //function : ErrorOnSurface |
135 | //purpose : |
136 | //======================================================================= |
137 | |
138 | Standard_Real BRepOffsetAPI_MakePipe::ErrorOnSurface() const |
139 | { |
140 | return myPipe.ErrorOnSurface(); |
141 | } |