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> |
25 | |
26 | //======================================================================= |
27 | //function : BRepOffsetAPI_MakePipe |
471ce736 |
28 | //purpose : constructor |
7fd59977 |
29 | //======================================================================= |
30 | |
31 | BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine , |
471ce736 |
32 | const TopoDS_Shape& Profile) |
7fd59977 |
33 | : myPipe(Spine, Profile) |
34 | { |
35 | Build(); |
36 | } |
37 | |
a31abc03 |
38 | //======================================================================= |
471ce736 |
39 | //function : BRepOffsetAPI_MakePipe |
40 | //purpose : constructor |
41 | // Set the mode of sweeping |
a31abc03 |
42 | // It can be: |
43 | // - Frenet |
44 | // - Corrected Frenet |
45 | // - Discrete Trihedron |
471ce736 |
46 | // Also set the flag that indicates attempt to approximate |
a31abc03 |
47 | // a C1-continuous surface if a swept surface proved |
48 | // to be C0. |
49 | //======================================================================= |
50 | |
471ce736 |
51 | BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine , |
52 | const TopoDS_Shape& Profile, |
53 | const GeomFill_Trihedron aMode, |
54 | const Standard_Boolean ForceApproxC1) |
55 | : myPipe(Spine, Profile, aMode, ForceApproxC1) |
a31abc03 |
56 | { |
471ce736 |
57 | Build(); |
a31abc03 |
58 | } |
59 | |
7fd59977 |
60 | //======================================================================= |
61 | //function : Pipe |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | const BRepFill_Pipe& BRepOffsetAPI_MakePipe::Pipe() const |
66 | { |
67 | return myPipe; |
68 | } |
69 | |
70 | |
71 | //======================================================================= |
72 | //function : Build |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | void BRepOffsetAPI_MakePipe::Build() |
77 | { |
78 | myShape = myPipe.Shape(); |
79 | Done(); |
80 | } |
81 | |
82 | |
83 | //======================================================================= |
84 | //function : FirstShape |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | TopoDS_Shape BRepOffsetAPI_MakePipe::FirstShape() |
89 | { |
90 | return myPipe.FirstShape(); |
91 | } |
92 | |
93 | |
94 | //======================================================================= |
95 | //function : LastShape |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape() |
100 | { |
101 | return myPipe.LastShape(); |
102 | } |
103 | |
104 | |
105 | //======================================================================= |
106 | //function : Generated |
107 | //purpose : |
108 | //======================================================================= |
109 | |
110 | TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine, |
111 | const TopoDS_Shape& SProfile) |
112 | { |
113 | if (SProfile.ShapeType () == TopAbs_EDGE) { |
114 | return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile)); |
115 | } |
116 | else if (SProfile.ShapeType () == TopAbs_VERTEX) { |
117 | return myPipe.Edge (TopoDS::Edge (SSpine), TopoDS::Vertex (SProfile)); |
118 | } |
119 | |
120 | //POP pour NT |
121 | TopoDS_Shape bid; |
122 | return bid; |
123 | } |
124 | |