Salome HOME
Issue #1774: Can't select edge for tangent constraint creation
[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
90 /// \ingroup CPPHighAPI
91 /// \brief Interface for ExtrusionCut feature.
92 class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
93 {
94 public:
95
96   static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
97   virtual std::string getID() { return ID(); }
98
99   //FEATURESAPI_EXPORT
100   //virtual std::string getID() {
101   //  return FeaturesPlugin_ExtrusionCut::ID();
102   //}
103
104   /// Constructor without values.
105   FEATURESAPI_EXPORT
106   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
107
108   /// Constructor with values.
109   FEATURESAPI_EXPORT
110   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
111                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
112                                     const ModelHighAPI_Double& theSize,
113                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
114
115   /// Constructor with values.
116   FEATURESAPI_EXPORT
117   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
118                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
119                                     const ModelHighAPI_Selection& theDirection,
120                                     const ModelHighAPI_Double& theSize,
121                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
122
123   /// Constructor with values.
124   FEATURESAPI_EXPORT
125   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
126                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
127                                     const ModelHighAPI_Double& theToSize,
128                                     const ModelHighAPI_Double& theFromSize,
129                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
130
131   /// Constructor with values.
132   FEATURESAPI_EXPORT
133   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
134                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
135                                     const ModelHighAPI_Selection& theDirection,
136                                     const ModelHighAPI_Double& theToSize,
137                                     const ModelHighAPI_Double& theFromSize,
138                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
139
140   /// Constructor with values.
141   FEATURESAPI_EXPORT
142   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
143                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
144                                     const ModelHighAPI_Selection& theToObject,
145                                     const ModelHighAPI_Double& theToOffset,
146                                     const ModelHighAPI_Selection& theFromObject,
147                                     const ModelHighAPI_Double& theFromOffset,
148                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
149
150   /// Constructor with values.
151   FEATURESAPI_EXPORT
152   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
153                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
154                                     const ModelHighAPI_Selection& theDirection,
155                                     const ModelHighAPI_Selection& theToObject,
156                                     const ModelHighAPI_Double& theToOffset,
157                                     const ModelHighAPI_Selection& theFromObject,
158                                     const ModelHighAPI_Double& theFromOffset,
159                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
160 };
161
162 /// Pointer on ExtrusionCut object.
163 typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
164
165 /// \ingroup CPPHighAPI
166 /// \brief Create ExtrusionCut feature.
167 FEATURESAPI_EXPORT
168 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
169                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
170                                 const ModelHighAPI_Double& theSize,
171                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
172
173 /// \ingroup CPPHighAPI
174 /// \brief Create ExtrusionCut feature.
175 FEATURESAPI_EXPORT
176 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
177                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
178                                 const ModelHighAPI_Selection& theDirection,
179                                 const ModelHighAPI_Double& theSize,
180                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
181
182 /// \ingroup CPPHighAPI
183 /// \brief Create ExtrusionCut feature.
184 FEATURESAPI_EXPORT
185 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
186                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
187                                 const ModelHighAPI_Double& theToSize,
188                                 const ModelHighAPI_Double& theFromSize,
189                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
190
191 /// \ingroup CPPHighAPI
192 /// \brief Create ExtrusionCut feature.
193 FEATURESAPI_EXPORT
194 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
195                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
196                                 const ModelHighAPI_Selection& theDirection,
197                                 const ModelHighAPI_Double& theToSize,
198                                 const ModelHighAPI_Double& theFromSize,
199                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
200
201 /// \ingroup CPPHighAPI
202 /// \brief Create ExtrusionCut feature.
203 FEATURESAPI_EXPORT
204 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
205                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
206                                 const ModelHighAPI_Selection& theToObject,
207                                 const ModelHighAPI_Double& theToOffset,
208                                 const ModelHighAPI_Selection& theFromObject,
209                                 const ModelHighAPI_Double& theFromOffset,
210                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
211
212 /// \ingroup CPPHighAPI
213 /// \brief Create ExtrusionCut feature.
214 FEATURESAPI_EXPORT
215 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
216                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
217                                 const ModelHighAPI_Selection& theDirection,
218                                 const ModelHighAPI_Selection& theToObject,
219                                 const ModelHighAPI_Double& theToOffset,
220                                 const ModelHighAPI_Selection& theFromObject,
221                                 const ModelHighAPI_Double& theFromOffset,
222                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
223
224 /// \class FeaturesAPI_ExtrusionFuse
225 /// \ingroup CPPHighAPI
226 /// \brief Interface for ExtrusionFuse feature.
227 class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
228 {
229 public:
230   static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); }
231   virtual std::string getID() { return ID(); }
232
233   /// Constructor without values.
234   FEATURESAPI_EXPORT
235   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
236
237   /// Constructor with values.
238   FEATURESAPI_EXPORT
239   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
240                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
241                                      const ModelHighAPI_Double& theSize,
242                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
243
244   /// Constructor with values.
245   FEATURESAPI_EXPORT
246   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
247                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
248                                      const ModelHighAPI_Selection& theDirection,
249                                      const ModelHighAPI_Double& theSize,
250                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
251
252   /// Constructor with values.
253   FEATURESAPI_EXPORT
254   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
255                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
256                                      const ModelHighAPI_Double& theToSize,
257                                      const ModelHighAPI_Double& theFromSize,
258                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
259
260   /// Constructor with values.
261   FEATURESAPI_EXPORT
262   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
263                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
264                                      const ModelHighAPI_Selection& theDirection,
265                                      const ModelHighAPI_Double& theToSize,
266                                      const ModelHighAPI_Double& theFromSize,
267                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
268
269   /// Constructor with values.
270   FEATURESAPI_EXPORT
271   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
272                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
273                                      const ModelHighAPI_Selection& theToObject,
274                                      const ModelHighAPI_Double& theToOffset,
275                                      const ModelHighAPI_Selection& theFromObject,
276                                      const ModelHighAPI_Double& theFromOffset,
277                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
278
279   /// Constructor with values.
280   FEATURESAPI_EXPORT
281   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
282                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
283                                      const ModelHighAPI_Selection& theDirection,
284                                      const ModelHighAPI_Selection& theToObject,
285                                      const ModelHighAPI_Double& theToOffset,
286                                      const ModelHighAPI_Selection& theFromObject,
287                                      const ModelHighAPI_Double& theFromOffset,
288                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
289 };
290
291 /// Pointer on ExtrusionFuse object.
292 typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
293
294 /// \ingroup CPPHighAPI
295 /// \brief Create ExtrusionFuse feature.
296 FEATURESAPI_EXPORT
297 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
298                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
299                                   const ModelHighAPI_Double& theSize,
300                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
301
302 /// \ingroup CPPHighAPI
303 /// \brief Create ExtrusionFuse feature.
304 FEATURESAPI_EXPORT
305 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
306                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
307                                   const ModelHighAPI_Selection& theDirection,
308                                   const ModelHighAPI_Double& theSize,
309                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
310
311 /// \ingroup CPPHighAPI
312 /// \brief Create ExtrusionFuse feature.
313 FEATURESAPI_EXPORT
314 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
315                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
316                                   const ModelHighAPI_Double& theToSize,
317                                   const ModelHighAPI_Double& theFromSize,
318                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
319
320 /// \ingroup CPPHighAPI
321 /// \brief Create ExtrusionFuse feature.
322 FEATURESAPI_EXPORT
323 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
324                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
325                                   const ModelHighAPI_Selection& theDirection,
326                                   const ModelHighAPI_Double& theToSize,
327                                   const ModelHighAPI_Double& theFromSize,
328                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
329
330 /// \ingroup CPPHighAPI
331 /// \brief Create ExtrusionFuse feature.
332 FEATURESAPI_EXPORT
333 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
334                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
335                                   const ModelHighAPI_Selection& theToObject,
336                                   const ModelHighAPI_Double& theToOffset,
337                                   const ModelHighAPI_Selection& theFromObject,
338                                   const ModelHighAPI_Double& theFromOffset,
339                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
340
341 /// \ingroup CPPHighAPI
342 /// \brief Create ExtrusionFuse feature.
343 FEATURESAPI_EXPORT
344 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
345                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
346                                   const ModelHighAPI_Selection& theDirection,
347                                   const ModelHighAPI_Selection& theToObject,
348                                   const ModelHighAPI_Double& theToOffset,
349                                   const ModelHighAPI_Selection& theFromObject,
350                                   const ModelHighAPI_Double& theFromOffset,
351                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
352
353 #endif // FeaturesAPI_ExtrusionBoolean_H_