Salome HOME
67a97e69c8e9a4fb730c22f629a66df3b659c26f
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_ExtrusionBoolean.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_ExtrusionBoolean.h
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesAPI_ExtrusionBoolean_H_
8 #define FeaturesAPI_ExtrusionBoolean_H_
9
10 #include "FeaturesAPI.h"
11
12 #include <FeaturesPlugin_ExtrusionCut.h>
13 #include <FeaturesPlugin_ExtrusionFuse.h>
14
15 #include <ModelHighAPI_Interface.h>
16 #include <ModelHighAPI_Macro.h>
17
18 class ModelHighAPI_Double;
19 class ModelHighAPI_Reference;
20 class ModelHighAPI_Selection;
21
22 /// \class FeaturesAPI_ExtrusionBoolean
23 /// \ingroup CPPHighAPI
24 /// \brief Interface for ExtrusionBoolean feature.
25 class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface
26 {
27 public:
28   /// Destructor.
29   FEATURESAPI_EXPORT
30   virtual ~FeaturesAPI_ExtrusionBoolean();
31
32   INTERFACE_11("",
33                sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */,
34                baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
35                direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */,
36                creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
37                toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, /** To size */,
38                fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, /** From size */,
39                toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
40                toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
41                fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
42                fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
43                booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Boolean objects */)
44
45   /// Modify base attribute of the feature.
46   FEATURESAPI_EXPORT
47   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
48
49   /// Modify base attribute of the feature.
50   FEATURESAPI_EXPORT
51   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
52
53   /// Modify direction_object attribute of the feature.
54   FEATURESAPI_EXPORT
55   void setDirection(const ModelHighAPI_Selection& theDirection);
56
57   /// Modify CreationMethod, to_size, from_size attributes of the feature.
58   FEATURESAPI_EXPORT
59   void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
60
61   /// Modify creation_method, to_size, from_size attributes of the feature.
62   FEATURESAPI_EXPORT
63   void setSize(const ModelHighAPI_Double& theSize);
64
65   /// Modify creation_method, to_object, to_offset, from_object, from_offset attributes of the feature.
66   FEATURESAPI_EXPORT
67   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
68                            const ModelHighAPI_Double& theToOffset,
69                            const ModelHighAPI_Selection& theFromObject,
70                            const ModelHighAPI_Double& theFromOffset);
71
72   /// Modiyfy main_objects attribute of the feature.
73   FEATURESAPI_EXPORT
74   void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
75
76   /// Dump wrapped feature
77   FEATURESAPI_EXPORT
78   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
79
80 protected:
81   /// Constructor without values.
82   FEATURESAPI_EXPORT
83   explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
84
85 private:
86   void execIfBaseNotEmpty();
87 };
88
89 class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
90 {
91 public:
92
93   static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
94   virtual std::string getID() { return ID(); }
95
96   //FEATURESAPI_EXPORT
97   //virtual std::string getID() {
98   //  return FeaturesPlugin_ExtrusionCut::ID();
99   //}
100
101   /// Constructor without values.
102   FEATURESAPI_EXPORT
103   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
104
105   /// Constructor with values.
106   FEATURESAPI_EXPORT
107   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
108                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
109                                     const ModelHighAPI_Double& theSize,
110                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
111
112   /// Constructor with values.
113   FEATURESAPI_EXPORT
114   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
115                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
116                                     const ModelHighAPI_Selection& theDirection,
117                                     const ModelHighAPI_Double& theSize,
118                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
119
120   /// Constructor with values.
121   FEATURESAPI_EXPORT
122   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
123                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
124                                     const ModelHighAPI_Double& theToSize,
125                                     const ModelHighAPI_Double& theFromSize,
126                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
127
128   /// Constructor with values.
129   FEATURESAPI_EXPORT
130   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
131                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
132                                     const ModelHighAPI_Selection& theDirection,
133                                     const ModelHighAPI_Double& theToSize,
134                                     const ModelHighAPI_Double& theFromSize,
135                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
136
137   /// Constructor with values.
138   FEATURESAPI_EXPORT
139   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
140                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
141                                     const ModelHighAPI_Selection& theToObject,
142                                     const ModelHighAPI_Double& theToOffset,
143                                     const ModelHighAPI_Selection& theFromObject,
144                                     const ModelHighAPI_Double& theFromOffset,
145                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
146
147   /// Constructor with values.
148   FEATURESAPI_EXPORT
149   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
150                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
151                                     const ModelHighAPI_Selection& theDirection,
152                                     const ModelHighAPI_Selection& theToObject,
153                                     const ModelHighAPI_Double& theToOffset,
154                                     const ModelHighAPI_Selection& theFromObject,
155                                     const ModelHighAPI_Double& theFromOffset,
156                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
157 };
158
159 /// Pointer on ExtrusionCut object.
160 typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
161
162 /// \ingroup CPPHighAPI
163 /// \brief Create ExtrusionCut feature.
164 FEATURESAPI_EXPORT
165 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
166                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
167                                 const ModelHighAPI_Double& theSize,
168                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
169
170 /// \ingroup CPPHighAPI
171 /// \brief Create ExtrusionCut feature.
172 FEATURESAPI_EXPORT
173 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
174                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
175                                 const ModelHighAPI_Selection& theDirection,
176                                 const ModelHighAPI_Double& theSize,
177                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
178
179 /// \ingroup CPPHighAPI
180 /// \brief Create ExtrusionCut feature.
181 FEATURESAPI_EXPORT
182 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
183                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
184                                 const ModelHighAPI_Double& theToSize,
185                                 const ModelHighAPI_Double& theFromSize,
186                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
187
188 /// \ingroup CPPHighAPI
189 /// \brief Create ExtrusionCut feature.
190 FEATURESAPI_EXPORT
191 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
192                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
193                                 const ModelHighAPI_Selection& theDirection,
194                                 const ModelHighAPI_Double& theToSize,
195                                 const ModelHighAPI_Double& theFromSize,
196                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
197
198 /// \ingroup CPPHighAPI
199 /// \brief Create ExtrusionCut feature.
200 FEATURESAPI_EXPORT
201 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
202                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
203                                 const ModelHighAPI_Selection& theToObject,
204                                 const ModelHighAPI_Double& theToOffset,
205                                 const ModelHighAPI_Selection& theFromObject,
206                                 const ModelHighAPI_Double& theFromOffset,
207                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
208
209 /// \ingroup CPPHighAPI
210 /// \brief Create ExtrusionCut feature.
211 FEATURESAPI_EXPORT
212 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
213                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
214                                 const ModelHighAPI_Selection& theDirection,
215                                 const ModelHighAPI_Selection& theToObject,
216                                 const ModelHighAPI_Double& theToOffset,
217                                 const ModelHighAPI_Selection& theFromObject,
218                                 const ModelHighAPI_Double& theFromOffset,
219                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
220
221 class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
222 {
223 public:
224   FEATURESAPI_EXPORT
225   virtual std::string getID() {
226     return FeaturesPlugin_ExtrusionFuse::ID();
227   }
228
229   /// Constructor without values.
230   FEATURESAPI_EXPORT
231   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
232
233   /// Constructor with values.
234   FEATURESAPI_EXPORT
235   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
236                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
237                                      const ModelHighAPI_Double& theSize,
238                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
239
240   /// Constructor with values.
241   FEATURESAPI_EXPORT
242   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
243                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
244                                      const ModelHighAPI_Selection& theDirection,
245                                      const ModelHighAPI_Double& theSize,
246                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
247
248   /// Constructor with values.
249   FEATURESAPI_EXPORT
250   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
251                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
252                                      const ModelHighAPI_Double& theToSize,
253                                      const ModelHighAPI_Double& theFromSize,
254                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
255
256   /// Constructor with values.
257   FEATURESAPI_EXPORT
258   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
259                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
260                                      const ModelHighAPI_Selection& theDirection,
261                                      const ModelHighAPI_Double& theToSize,
262                                      const ModelHighAPI_Double& theFromSize,
263                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
264
265   /// Constructor with values.
266   FEATURESAPI_EXPORT
267   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
268                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
269                                      const ModelHighAPI_Selection& theToObject,
270                                      const ModelHighAPI_Double& theToOffset,
271                                      const ModelHighAPI_Selection& theFromObject,
272                                      const ModelHighAPI_Double& theFromOffset,
273                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
274
275   /// Constructor with values.
276   FEATURESAPI_EXPORT
277   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
278                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
279                                      const ModelHighAPI_Selection& theDirection,
280                                      const ModelHighAPI_Selection& theToObject,
281                                      const ModelHighAPI_Double& theToOffset,
282                                      const ModelHighAPI_Selection& theFromObject,
283                                      const ModelHighAPI_Double& theFromOffset,
284                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
285 };
286
287 /// Pointer on ExtrusionFuse object.
288 typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
289
290 /// \ingroup CPPHighAPI
291 /// \brief Create ExtrusionFuse feature.
292 FEATURESAPI_EXPORT
293 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
294                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
295                                   const ModelHighAPI_Double& theSize,
296                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
297
298 /// \ingroup CPPHighAPI
299 /// \brief Create ExtrusionFuse feature.
300 FEATURESAPI_EXPORT
301 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
302                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
303                                   const ModelHighAPI_Selection& theDirection,
304                                   const ModelHighAPI_Double& theSize,
305                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
306
307 /// \ingroup CPPHighAPI
308 /// \brief Create ExtrusionFuse feature.
309 FEATURESAPI_EXPORT
310 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
311                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
312                                   const ModelHighAPI_Double& theToSize,
313                                   const ModelHighAPI_Double& theFromSize,
314                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
315
316 /// \ingroup CPPHighAPI
317 /// \brief Create ExtrusionFuse feature.
318 FEATURESAPI_EXPORT
319 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
320                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
321                                   const ModelHighAPI_Selection& theDirection,
322                                   const ModelHighAPI_Double& theToSize,
323                                   const ModelHighAPI_Double& theFromSize,
324                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
325
326 /// \ingroup CPPHighAPI
327 /// \brief Create ExtrusionFuse feature.
328 FEATURESAPI_EXPORT
329 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
330                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
331                                   const ModelHighAPI_Selection& theToObject,
332                                   const ModelHighAPI_Double& theToOffset,
333                                   const ModelHighAPI_Selection& theFromObject,
334                                   const ModelHighAPI_Double& theFromOffset,
335                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
336
337 /// \ingroup CPPHighAPI
338 /// \brief Create ExtrusionFuse feature.
339 FEATURESAPI_EXPORT
340 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
341                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
342                                   const ModelHighAPI_Selection& theDirection,
343                                   const ModelHighAPI_Selection& theToObject,
344                                   const ModelHighAPI_Double& theToOffset,
345                                   const ModelHighAPI_Selection& theFromObject,
346                                   const ModelHighAPI_Double& theFromOffset,
347                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
348
349 #endif // FeaturesAPI_ExtrusionBoolean_H_