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_Form_HeaderFile
18 #define _BRepFeat_Form_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <Standard_Boolean.hxx>
25 #include <TopTools_DataMapOfShapeListOfShape.hxx>
26 #include <TopoDS_Shape.hxx>
27 #include <TopTools_ListOfShape.hxx>
28 #include <BRepFeat_PerfSelection.hxx>
29 #include <TopoDS_Face.hxx>
30 #include <TopTools_DataMapOfShapeShape.hxx>
31 #include <BRepFeat_StatusError.hxx>
32 #include <BRepBuilderAPI_MakeShape.hxx>
33 #include <TColGeom_SequenceOfCurve.hxx>
34 #include <Standard_Integer.hxx>
35 class TopoDS_Shape;
36 class Geom_Curve;
37 class LocOpe_Gluer;
38 class BRepAlgoAPI_BooleanOperation;
39 
40 
41 //! Provides general functions to build form features.
42 //! Form features can be depressions or protrusions and include the following types:
43 //! -          Cylinder
44 //! -          Draft Prism
45 //! -          Prism
46 //! -          Revolved feature
47 //! -          Pipe
48 //! In each case, you have a choice of operation type between the following:
49 //! -          removing matter (a Boolean cut: Fuse setting 0)
50 //! -          adding matter (Boolean fusion: Fuse setting 1)
51 //! The semantics of form feature creation is based on the construction of shapes:
52 //! -      along a length
53 //! -      up to a limiting face
54 //! -      from a limiting face to a  height
55 //! -      above and/or below a plane
56 //! The shape defining construction of the feature can be either the
57 //! supporting edge or the concerned area of a face.
58 //! In case of the supporting edge, this contour can be attached to a
59 //! face of the basis shape by binding. When the contour is bound to this
60 //! face, the information that the contour will slide on the face
61 //! becomes available to the relevant class methods. In case of the
62 //! concerned area of a face, you could, for example, cut it out and
63 //! move it to a different height which will define the limiting face of a
64 //! protrusion or depression.
65 //! Topological definition with local operations of this sort makes
66 //! calculations simpler and faster than a global operation. The latter
67 //! would entail a second phase of removing unwanted matter to get the same result.
68 class BRepFeat_Form  : public BRepBuilderAPI_MakeShape
69 {
70 public:
71 
72   DEFINE_STANDARD_ALLOC
73 
74 
75   //! returns the list of generated Faces.
76   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
77 
78   //! returns a list of the created faces
79   //! from the shape <S>.
80   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
81 
82   Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
83 
84   //! Returns the list  of shapes created  at the bottom  of
85   //! the created form.  It may be an empty list.
86   Standard_EXPORT const TopTools_ListOfShape& FirstShape() const;
87 
88   //! Returns  the list of shapes  created at the top of the
89   //! created form.  It may be an empty list.
90   Standard_EXPORT const TopTools_ListOfShape& LastShape() const;
91 
92   //! Returns a list of the limiting and glueing edges
93   //! generated by the feature. These edges did not originally
94   //! exist in the basis shape.
95   //! The list provides the information necessary for
96   //! subsequent addition of fillets. It may be an empty list.
97   Standard_EXPORT const TopTools_ListOfShape& NewEdges() const;
98 
99   //! Returns a list of the tangent edges among the limiting
100   //! and glueing edges generated by the feature. These
101   //! edges did not originally exist in the basis shape and are
102   //! tangent to the face against which the feature is built.
103   //! The list provides the information necessary for
104   //! subsequent addition of fillets. It may be an empty list.
105   //! If an edge is tangent, no fillet is possible, and the edge
106   //! must subsequently be removed if you want to add a fillet.
107   Standard_EXPORT const TopTools_ListOfShape& TgtEdges() const;
108 
109   //! Initializes the topological construction if the basis shape is present.
110     void BasisShapeValid();
111 
112   //! Initializes the topological construction if the generated shape S is present.
113     void GeneratedShapeValid();
114 
115 
116   //! Initializes the topological construction if the shape is
117   //! present from the specified integer on.
118     void ShapeFromValid();
119 
120 
121   //! Initializes the topological construction if the shape is
122   //! present until the specified integer.
123     void ShapeUntilValid();
124 
125 
126   //! Initializes the topological construction if the glued face is present.
127     void GluedFacesValid();
128 
129 
130   //! Initializes the topological construction if the sketch face
131   //! is present. If the sketch face is inside the basis shape,
132   //! local operations such as glueing can be performed.
133     void SketchFaceValid();
134 
135   //! Initializes the topological construction if the selected face is present.
136     void PerfSelectionValid();
137 
138   Standard_EXPORT virtual void Curves (TColGeom_SequenceOfCurve& S) = 0;
139 
140   Standard_EXPORT virtual Handle(Geom_Curve) BarycCurve() = 0;
141 
142   Standard_EXPORT BRepFeat_StatusError CurrentStatusError() const;
143 
144 
145 
146 
147 protected:
148 
149 
150   //! Redefines the empty constructor.
151     BRepFeat_Form();
152 
153   //! General perform method...
154   Standard_EXPORT void GlobalPerform();
155 
156   Standard_EXPORT void UpdateDescendants (const LocOpe_Gluer& G);
157 
158   Standard_EXPORT void UpdateDescendants (const BRepAlgoAPI_BooleanOperation& aBOP, const TopoDS_Shape& SResult, const Standard_Boolean SkipFace = Standard_False);
159 
160   Standard_EXPORT Standard_Boolean TransformShapeFU (const Standard_Integer flag);
161 
162 
163   Standard_Boolean myFuse;
164   Standard_Boolean myModify;
165   TopTools_DataMapOfShapeListOfShape myMap;
166   TopoDS_Shape myFShape;
167   TopoDS_Shape myLShape;
168   TopTools_ListOfShape myNewEdges;
169   TopTools_ListOfShape myTgtEdges;
170   BRepFeat_PerfSelection myPerfSelection;
171   Standard_Boolean myJustGluer;
172   Standard_Boolean myJustFeat;
173   TopoDS_Shape mySbase;
174   TopoDS_Face mySkface;
175   TopoDS_Shape myGShape;
176   TopoDS_Shape mySFrom;
177   TopoDS_Shape mySUntil;
178   TopTools_DataMapOfShapeShape myGluedF;
179 
180 
181 private:
182 
183 
184 
185   Standard_Boolean mySbOK;
186   Standard_Boolean mySkOK;
187   Standard_Boolean myGSOK;
188   Standard_Boolean mySFOK;
189   Standard_Boolean mySUOK;
190   Standard_Boolean myGFOK;
191   Standard_Boolean myPSOK;
192   BRepFeat_StatusError myStatusError;
193 
194 
195 };
196 
197 
198 #include <BRepFeat_Form.lxx>
199 
200 
201 
202 
203 
204 #endif // _BRepFeat_Form_HeaderFile
205