42cf5bc1 |
1 | // Created on: 1996-02-13 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _BRepFeat_MakePrism_HeaderFile |
18 | #define _BRepFeat_MakePrism_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopoDS_Shape.hxx> |
25 | #include <TopTools_DataMapOfShapeListOfShape.hxx> |
26 | #include <gp_Dir.hxx> |
27 | #include <TColGeom_SequenceOfCurve.hxx> |
28 | #include <BRepFeat_StatusError.hxx> |
29 | #include <BRepFeat_Form.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <Standard_Boolean.hxx> |
32 | #include <Standard_Real.hxx> |
33 | class Geom_Curve; |
34 | class Standard_ConstructionError; |
35 | class TopoDS_Shape; |
36 | class TopoDS_Face; |
37 | class gp_Dir; |
38 | class TopoDS_Edge; |
39 | |
40 | |
41 | //! Describes functions to build prism features. |
42 | //! These can be depressions or protrusions. |
43 | //! The semantics of prism feature creation is |
44 | //! based on the construction of shapes: |
45 | //! - along a length |
46 | //! - up to a limiting face |
47 | //! - from a limiting face to a height. |
48 | //! The shape defining construction of the prism feature can be |
49 | //! either the supporting edge or the concerned area of a face. |
50 | //! In case of the supporting edge, this contour |
51 | //! can be attached to a face of the basis shape by |
52 | //! binding. When the contour is bound to this face, |
53 | //! the information that the contour will slide on the |
54 | //! face becomes available to the relevant class methods. |
55 | //! In case of the concerned area of a face, you |
56 | //! could, for example, cut it out and move it to a |
57 | //! different height which will define the limiting |
58 | //! face of a protrusion or depression. |
59 | class BRepFeat_MakePrism : public BRepFeat_Form |
60 | { |
61 | public: |
62 | |
63 | DEFINE_STANDARD_ALLOC |
64 | |
65 | |
66 | //! Builds a prism by projecting a |
67 | //! wire along the face of a shape. Initializes the prism class. |
68 | BRepFeat_MakePrism(); |
69 | |
70 | //! Builds a prism by projecting a |
71 | //! wire along the face of a shape. a face Pbase is selected in |
72 | //! the shape Sbase to serve as the basis for |
73 | //! the prism. The orientation of the prism will |
74 | //! be defined by the vector Direction. |
75 | //! Fuse offers a choice between: |
76 | //! - removing matter with a Boolean cut using the setting 0 |
77 | //! - adding matter with Boolean fusion using the setting 1. |
78 | //! The sketch face Skface serves to determine |
79 | //! the type of operation. If it is inside the basis |
80 | //! shape, a local operation such as glueing can be performed. |
81 | //! Exceptions |
82 | //! Standard_ConstructionError if the face |
83 | //! does not belong to the basis or the prism shape. |
84 | BRepFeat_MakePrism(const TopoDS_Shape& Sbase, const TopoDS_Shape& Pbase, const TopoDS_Face& Skface, const gp_Dir& Direction, const Standard_Integer Fuse, const Standard_Boolean Modify); |
85 | |
86 | //! Initializes this algorithm for building prisms along surfaces. |
87 | //! A face Pbase is selected in the shape Sbase |
88 | //! to serve as the basis for the prism. The |
89 | //! orientation of the prism will be defined by the vector Direction. |
90 | //! Fuse offers a choice between: |
91 | //! - removing matter with a Boolean cut using the setting 0 |
92 | //! - adding matter with Boolean fusion using the setting 1. |
93 | //! The sketch face Skface serves to determine |
94 | //! the type of operation. If it is inside the basis |
95 | //! shape, a local operation such as glueing can be performed. |
96 | Standard_EXPORT void Init (const TopoDS_Shape& Sbase, const TopoDS_Shape& Pbase, const TopoDS_Face& Skface, const gp_Dir& Direction, const Standard_Integer Fuse, const Standard_Boolean Modify); |
97 | |
98 | //! Indicates that the edge <E> will slide on the face |
99 | //! <OnFace>. Raises ConstructionError if the face does not belong to the |
100 | //! basis shape, or the edge to the prismed shape. |
101 | Standard_EXPORT void Add (const TopoDS_Edge& E, const TopoDS_Face& OnFace); |
102 | |
103 | Standard_EXPORT void Perform (const Standard_Real Length); |
104 | |
105 | Standard_EXPORT void Perform (const TopoDS_Shape& Until); |
106 | |
107 | //! Assigns one of the following semantics |
108 | //! - to a height Length |
109 | //! - to a face Until |
110 | //! - from a face From to a height Until. |
111 | //! Reconstructs the feature topologically according to the semantic option chosen. |
112 | Standard_EXPORT void Perform (const TopoDS_Shape& From, const TopoDS_Shape& Until); |
113 | |
114 | //! Realizes a semi-infinite prism, limited by the |
115 | //! position of the prism base. All other faces extend infinitely. |
116 | Standard_EXPORT void PerformUntilEnd(); |
117 | |
118 | //! Realizes a semi-infinite prism, limited by the face Funtil. |
119 | Standard_EXPORT void PerformFromEnd (const TopoDS_Shape& FUntil); |
120 | |
121 | //! Builds an infinite prism. The infinite descendants will not be kept in the result. |
122 | Standard_EXPORT void PerformThruAll(); |
123 | |
124 | //! Assigns both a limiting shape, Until from |
125 | //! TopoDS_Shape, and a height, Length at which to stop generation of the prism feature. |
126 | Standard_EXPORT void PerformUntilHeight (const TopoDS_Shape& Until, const Standard_Real Length); |
127 | |
128 | //! Returns the list of curves S parallel to the axis of the prism. |
129 | Standard_EXPORT void Curves (TColGeom_SequenceOfCurve& S); |
130 | |
131 | //! Generates a curve along the center of mass of the primitive. |
132 | Standard_EXPORT Handle(Geom_Curve) BarycCurve(); |
133 | |
134 | |
135 | |
136 | |
137 | protected: |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | private: |
144 | |
145 | |
146 | |
147 | TopoDS_Shape myPbase; |
148 | TopTools_DataMapOfShapeListOfShape mySlface; |
149 | gp_Dir myDir; |
150 | TColGeom_SequenceOfCurve myCurves; |
151 | Handle(Geom_Curve) myBCurve; |
152 | BRepFeat_StatusError myStatusError; |
153 | |
154 | |
155 | }; |
156 | |
157 | |
158 | #include <BRepFeat_MakePrism.lxx> |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | #endif // _BRepFeat_MakePrism_HeaderFile |