1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef FeaturesAPI_ExtrusionBoolean_H_
21 #define FeaturesAPI_ExtrusionBoolean_H_
23 #include "FeaturesAPI.h"
25 #include <FeaturesPlugin_ExtrusionCut.h>
26 #include <FeaturesPlugin_ExtrusionFuse.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
31 class ModelHighAPI_Double;
32 class ModelHighAPI_Reference;
33 class ModelHighAPI_Selection;
35 /// \class FeaturesAPI_ExtrusionBoolean
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for ExtrusionBoolean feature.
38 class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface
43 virtual ~FeaturesAPI_ExtrusionBoolean();
46 sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
47 ModelAPI_AttributeReference, /** Sketch launcher */,
48 baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
49 ModelAPI_AttributeSelectionList, /** Base objects */,
50 direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
51 ModelAPI_AttributeSelection, /** Direction */,
52 creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
53 ModelAPI_AttributeString, /** Creation method */,
54 toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
55 ModelAPI_AttributeDouble, /** To size */,
56 fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
57 ModelAPI_AttributeDouble, /** From size */,
58 toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
59 ModelAPI_AttributeSelection, /** To object */,
60 toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
61 ModelAPI_AttributeDouble, /** To offset */,
62 fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
63 ModelAPI_AttributeSelection, /** From object */,
64 fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
65 ModelAPI_AttributeDouble, /** From offset */,
66 booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
67 ModelAPI_AttributeSelectionList, /** Boolean objects */)
69 /// Modify base attribute of the feature.
71 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
73 /// Modify base attribute of the feature.
75 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
77 /// Modify direction_object attribute of the feature.
79 void setDirection(const ModelHighAPI_Selection& theDirection);
81 /// Modify CreationMethod, to_size, from_size attributes of the feature.
83 void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
85 /// Modify creation_method, to_size, from_size attributes of the feature.
87 void setSize(const ModelHighAPI_Double& theSize);
89 /// Modify creation_method, to_object, to_offset, from_object,
90 /// from_offset attributes of the feature.
92 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
93 const ModelHighAPI_Double& theToOffset,
94 const ModelHighAPI_Selection& theFromObject,
95 const ModelHighAPI_Double& theFromOffset);
97 /// Modiyfy main_objects attribute of the feature.
99 void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
101 /// Dump wrapped feature
103 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
106 /// Constructor without values.
108 explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
111 void execIfBaseNotEmpty();
114 /// \class FeaturesAPI_ExtrusionCut
115 /// \ingroup CPPHighAPI
116 /// \brief Interface for ExtrusionCut feature.
117 class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
121 static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
122 virtual std::string getID() { return ID(); }
125 //virtual std::string getID() {
126 // return FeaturesPlugin_ExtrusionCut::ID();
129 /// Constructor without values.
131 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
133 /// Constructor with values.
135 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
136 const std::list<ModelHighAPI_Selection>& theBaseObjects,
137 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
139 /// Constructor with values.
141 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
142 const std::list<ModelHighAPI_Selection>& theBaseObjects,
143 const ModelHighAPI_Double& theSize,
144 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
146 /// Constructor with values.
148 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
149 const std::list<ModelHighAPI_Selection>& theBaseObjects,
150 const ModelHighAPI_Selection& theDirection,
151 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
153 /// Constructor with values.
155 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
156 const std::list<ModelHighAPI_Selection>& theBaseObjects,
157 const ModelHighAPI_Selection& theDirection,
158 const ModelHighAPI_Double& theSize,
159 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
161 /// Constructor with values.
163 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
164 const std::list<ModelHighAPI_Selection>& theBaseObjects,
165 const ModelHighAPI_Double& theToSize,
166 const ModelHighAPI_Double& theFromSize,
167 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
169 /// Constructor with values.
171 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
172 const std::list<ModelHighAPI_Selection>& theBaseObjects,
173 const ModelHighAPI_Selection& theDirection,
174 const ModelHighAPI_Double& theToSize,
175 const ModelHighAPI_Double& theFromSize,
176 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
178 /// Constructor with values.
180 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
181 const std::list<ModelHighAPI_Selection>& theBaseObjects,
182 const ModelHighAPI_Selection& theToObject,
183 const ModelHighAPI_Double& theToOffset,
184 const ModelHighAPI_Selection& theFromObject,
185 const ModelHighAPI_Double& theFromOffset,
186 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
188 /// Constructor with values.
190 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
191 const std::list<ModelHighAPI_Selection>& theBaseObjects,
192 const ModelHighAPI_Selection& theDirection,
193 const ModelHighAPI_Selection& theToObject,
194 const ModelHighAPI_Double& theToOffset,
195 const ModelHighAPI_Selection& theFromObject,
196 const ModelHighAPI_Double& theFromOffset,
197 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
200 /// Pointer on ExtrusionCut object.
201 typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
203 /// \ingroup CPPHighAPI
204 /// \brief Create ExtrusionCut feature.
206 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
207 const std::list<ModelHighAPI_Selection>& theBaseObjects,
208 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
210 /// \ingroup CPPHighAPI
211 /// \brief Create ExtrusionCut feature.
213 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
214 const std::list<ModelHighAPI_Selection>& theBaseObjects,
215 const ModelHighAPI_Double& theSize,
216 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
218 /// \ingroup CPPHighAPI
219 /// \brief Create ExtrusionCut feature.
221 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
222 const std::list<ModelHighAPI_Selection>& theBaseObjects,
223 const ModelHighAPI_Selection& theDirection,
224 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
226 /// \ingroup CPPHighAPI
227 /// \brief Create ExtrusionCut feature.
229 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
230 const std::list<ModelHighAPI_Selection>& theBaseObjects,
231 const ModelHighAPI_Selection& theDirection,
232 const ModelHighAPI_Double& theSize,
233 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
235 /// \ingroup CPPHighAPI
236 /// \brief Create ExtrusionCut feature.
238 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
239 const std::list<ModelHighAPI_Selection>& theBaseObjects,
240 const ModelHighAPI_Double& theToSize,
241 const ModelHighAPI_Double& theFromSize,
242 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
244 /// \ingroup CPPHighAPI
245 /// \brief Create ExtrusionCut feature.
247 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
248 const std::list<ModelHighAPI_Selection>& theBaseObjects,
249 const ModelHighAPI_Selection& theDirection,
250 const ModelHighAPI_Double& theToSize,
251 const ModelHighAPI_Double& theFromSize,
252 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
254 /// \ingroup CPPHighAPI
255 /// \brief Create ExtrusionCut feature.
257 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
258 const std::list<ModelHighAPI_Selection>& theBaseObjects,
259 const ModelHighAPI_Selection& theToObject,
260 const ModelHighAPI_Double& theToOffset,
261 const ModelHighAPI_Selection& theFromObject,
262 const ModelHighAPI_Double& theFromOffset,
263 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
265 /// \ingroup CPPHighAPI
266 /// \brief Create ExtrusionCut feature.
268 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
269 const std::list<ModelHighAPI_Selection>& theBaseObjects,
270 const ModelHighAPI_Selection& theDirection,
271 const ModelHighAPI_Selection& theToObject,
272 const ModelHighAPI_Double& theToOffset,
273 const ModelHighAPI_Selection& theFromObject,
274 const ModelHighAPI_Double& theFromOffset,
275 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
277 /// \class FeaturesAPI_ExtrusionFuse
278 /// \ingroup CPPHighAPI
279 /// \brief Interface for ExtrusionFuse feature.
280 class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
283 static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); }
284 virtual std::string getID() { return ID(); }
286 /// Constructor without values.
288 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
290 /// Constructor with values.
292 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
293 const std::list<ModelHighAPI_Selection>& theBaseObjects,
294 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
296 /// Constructor with values.
298 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
299 const std::list<ModelHighAPI_Selection>& theBaseObjects,
300 const ModelHighAPI_Double& theSize,
301 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
303 /// Constructor with values.
305 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
306 const std::list<ModelHighAPI_Selection>& theBaseObjects,
307 const ModelHighAPI_Selection& theDirection,
308 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
310 /// Constructor with values.
312 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
313 const std::list<ModelHighAPI_Selection>& theBaseObjects,
314 const ModelHighAPI_Selection& theDirection,
315 const ModelHighAPI_Double& theSize,
316 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
318 /// Constructor with values.
320 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
321 const std::list<ModelHighAPI_Selection>& theBaseObjects,
322 const ModelHighAPI_Double& theToSize,
323 const ModelHighAPI_Double& theFromSize,
324 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
326 /// Constructor with values.
328 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
329 const std::list<ModelHighAPI_Selection>& theBaseObjects,
330 const ModelHighAPI_Selection& theDirection,
331 const ModelHighAPI_Double& theToSize,
332 const ModelHighAPI_Double& theFromSize,
333 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
335 /// Constructor with values.
337 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
338 const std::list<ModelHighAPI_Selection>& theBaseObjects,
339 const ModelHighAPI_Selection& theToObject,
340 const ModelHighAPI_Double& theToOffset,
341 const ModelHighAPI_Selection& theFromObject,
342 const ModelHighAPI_Double& theFromOffset,
343 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
345 /// Constructor with values.
347 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
348 const std::list<ModelHighAPI_Selection>& theBaseObjects,
349 const ModelHighAPI_Selection& theDirection,
350 const ModelHighAPI_Selection& theToObject,
351 const ModelHighAPI_Double& theToOffset,
352 const ModelHighAPI_Selection& theFromObject,
353 const ModelHighAPI_Double& theFromOffset,
354 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
357 /// Pointer on ExtrusionFuse object.
358 typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
360 /// \ingroup CPPHighAPI
361 /// \brief Create ExtrusionFuse feature.
363 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
364 const std::list<ModelHighAPI_Selection>& theBaseObjects,
365 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
367 /// \ingroup CPPHighAPI
368 /// \brief Create ExtrusionFuse feature.
370 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
371 const std::list<ModelHighAPI_Selection>& theBaseObjects,
372 const ModelHighAPI_Double& theSize,
373 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
375 /// \ingroup CPPHighAPI
376 /// \brief Create ExtrusionFuse feature.
378 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
379 const std::list<ModelHighAPI_Selection>& theBaseObjects,
380 const ModelHighAPI_Selection& theDirection,
381 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
383 /// \ingroup CPPHighAPI
384 /// \brief Create ExtrusionFuse feature.
386 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
387 const std::list<ModelHighAPI_Selection>& theBaseObjects,
388 const ModelHighAPI_Selection& theDirection,
389 const ModelHighAPI_Double& theSize,
390 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
392 /// \ingroup CPPHighAPI
393 /// \brief Create ExtrusionFuse feature.
395 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
396 const std::list<ModelHighAPI_Selection>& theBaseObjects,
397 const ModelHighAPI_Double& theToSize,
398 const ModelHighAPI_Double& theFromSize,
399 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
401 /// \ingroup CPPHighAPI
402 /// \brief Create ExtrusionFuse feature.
404 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
405 const std::list<ModelHighAPI_Selection>& theBaseObjects,
406 const ModelHighAPI_Selection& theDirection,
407 const ModelHighAPI_Double& theToSize,
408 const ModelHighAPI_Double& theFromSize,
409 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
411 /// \ingroup CPPHighAPI
412 /// \brief Create ExtrusionFuse feature.
414 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
415 const std::list<ModelHighAPI_Selection>& theBaseObjects,
416 const ModelHighAPI_Selection& theToObject,
417 const ModelHighAPI_Double& theToOffset,
418 const ModelHighAPI_Selection& theFromObject,
419 const ModelHighAPI_Double& theFromOffset,
420 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
422 /// \ingroup CPPHighAPI
423 /// \brief Create ExtrusionFuse feature.
425 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
426 const std::list<ModelHighAPI_Selection>& theBaseObjects,
427 const ModelHighAPI_Selection& theDirection,
428 const ModelHighAPI_Selection& theToObject,
429 const ModelHighAPI_Double& theToOffset,
430 const ModelHighAPI_Selection& theFromObject,
431 const ModelHighAPI_Double& theFromOffset,
432 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
434 #endif // FeaturesAPI_ExtrusionBoolean_H_