Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_ExtrusionBoolean.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include "FeaturesAPI_ExtrusionBoolean.h"
22
23 #include <ModelHighAPI_Double.h>
24 #include <ModelHighAPI_Dumper.h>
25 #include <ModelHighAPI_Reference.h>
26 #include <ModelHighAPI_Tools.h>
27
28 //==================================================================================================
29 FeaturesAPI_ExtrusionBoolean::FeaturesAPI_ExtrusionBoolean(
30   const std::shared_ptr<ModelAPI_Feature>& theFeature)
31 : ModelHighAPI_Interface(theFeature)
32 {
33 }
34
35 //==================================================================================================
36 FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean()
37 {
38 }
39
40 //==================================================================================================
41 void FeaturesAPI_ExtrusionBoolean::setNestedSketch(const ModelHighAPI_Reference& theSketch)
42 {
43   mysketch->setValue(theSketch.feature());
44
45   // To make Sketch feature execute and subfeatures execute.
46   feature()->document()->setCurrentFeature(feature(), false);
47
48   // to inform that the history is updated due to the sketch moved under the composite feature
49   if (theSketch.feature().get()) {
50     theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group());
51     if (theSketch.feature()->firstResult().get())
52       theSketch.feature()->firstResult()->setDisplayed(false);
53   }
54   mybaseObjects->clear();
55   mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
56
57   execIfBaseNotEmpty();
58 }
59
60 //==================================================================================================
61 void FeaturesAPI_ExtrusionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
62 {
63   mysketch->setValue(ObjectPtr());
64   mybaseObjects->clear();
65   fillAttribute(theBaseObjects, mybaseObjects);
66
67   execIfBaseNotEmpty();
68 }
69
70 //==================================================================================================
71 void FeaturesAPI_ExtrusionBoolean::setDirection(const ModelHighAPI_Selection& theDirection)
72 {
73   fillAttribute(theDirection, mydirection);
74
75   execIfBaseNotEmpty();
76 }
77
78 //==================================================================================================
79 void FeaturesAPI_ExtrusionBoolean::setSizes(const ModelHighAPI_Double& theToSize,
80                                             const ModelHighAPI_Double& theFromSize)
81 {
82   fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
83   fillAttribute(theToSize, mytoSize);
84   fillAttribute(theFromSize, myfromSize);
85
86   execIfBaseNotEmpty();
87 }
88
89 //==================================================================================================
90 void FeaturesAPI_ExtrusionBoolean::setSize(const ModelHighAPI_Double& theSize)
91 {
92   fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
93   fillAttribute(theSize, mytoSize);
94   fillAttribute(ModelHighAPI_Double(), myfromSize);
95
96   execIfBaseNotEmpty();
97 }
98
99 //==================================================================================================
100 void FeaturesAPI_ExtrusionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
101                                                        const ModelHighAPI_Double& theToOffset,
102                                                        const ModelHighAPI_Selection& theFromObject,
103                                                        const ModelHighAPI_Double& theFromOffset)
104 {
105   fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
106   fillAttribute(theToObject, mytoObject);
107   fillAttribute(theToOffset, mytoOffset);
108   fillAttribute(theFromObject, myfromObject);
109   fillAttribute(theFromOffset, myfromOffset);
110
111   execIfBaseNotEmpty();
112 }
113
114 //==================================================================================================
115 void FeaturesAPI_ExtrusionBoolean::setBooleanObjects(
116   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
117 {
118   fillAttribute(theBooleanObjects, mybooleanObjects);
119
120   execIfBaseNotEmpty();
121 }
122
123 //==================================================================================================
124 void FeaturesAPI_ExtrusionBoolean::dump(ModelHighAPI_Dumper& theDumper) const
125 {
126   FeaturePtr aBase = feature();
127   const std::string& aDocName = theDumper.name(aBase->document());
128
129   AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID());
130   AttributeSelectionListPtr anAttrObjects =
131     aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID());
132   AttributeSelectionPtr anAttrDirection =
133     aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID());
134
135   theDumper << aBase << " = model.addExtrusion";
136   if(aBase->getKind() == FeaturesPlugin_ExtrusionCut::ID()) {
137     theDumper << "Cut";
138   } else if(aBase->getKind() == FeaturesPlugin_ExtrusionFuse::ID()) {
139     theDumper << "Fuse";
140   }
141   theDumper << "(" << aDocName << ", ";
142   anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects;
143   theDumper << ", " << anAttrDirection;
144
145   std::string aCreationMethod =
146     aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value();
147
148   if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) {
149     AttributeDoublePtr anAttrToSize = aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID());
150     AttributeDoublePtr anAttrFromSize = aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID());
151
152     theDumper << ", " << anAttrToSize << ", " << anAttrFromSize;
153   } else if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) {
154     AttributeSelectionPtr anAttrToObject =
155       aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID());
156     AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID());
157     AttributeSelectionPtr anAttrFromObject =
158       aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
159     AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID());
160
161     theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
162       ", " << anAttrFromObject << ", " << anAttrFromOffset;
163   }
164
165   AttributeSelectionListPtr anAttrBoolObjects =
166     aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID());
167   theDumper << ", " << anAttrBoolObjects << ")" << std::endl;
168
169   if(anAttrSketch->isInitialized()) {
170     theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl;
171   }
172 }
173
174 //==================================================================================================
175 void FeaturesAPI_ExtrusionBoolean::execIfBaseNotEmpty()
176 {
177   if(mybaseObjects->size() > 0) {
178     execute();
179   }
180 }
181
182
183 //==================================================================================================
184 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
185   const std::shared_ptr<ModelAPI_Feature>& theFeature)
186 : FeaturesAPI_ExtrusionBoolean(theFeature)
187 {
188   initialize();
189 }
190
191 //==================================================================================================
192 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
193   const std::shared_ptr<ModelAPI_Feature>& theFeature,
194   const std::list<ModelHighAPI_Selection>& theBaseObjects,
195   const ModelHighAPI_Double& theSize,
196   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
197 : FeaturesAPI_ExtrusionBoolean(theFeature)
198 {
199   if(initialize()) {
200     fillAttribute(theBaseObjects, mybaseObjects);
201     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
202     fillAttribute(theSize, mytoSize);
203     fillAttribute(ModelHighAPI_Double(), myfromSize);
204     setBooleanObjects(theBooleanObjects);
205   }
206 }
207
208 //==================================================================================================
209 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
210   const std::shared_ptr<ModelAPI_Feature>& theFeature,
211   const std::list<ModelHighAPI_Selection>& theBaseObjects,
212   const ModelHighAPI_Selection& theDirection,
213   const ModelHighAPI_Double& theSize,
214   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
215 : FeaturesAPI_ExtrusionBoolean(theFeature)
216 {
217   if(initialize()) {
218     fillAttribute(theBaseObjects, mybaseObjects);
219     fillAttribute(theDirection, mydirection);
220     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
221     fillAttribute(theSize, mytoSize);
222     fillAttribute(ModelHighAPI_Double(), myfromSize);
223     setBooleanObjects(theBooleanObjects);
224   }
225 }
226
227 //==================================================================================================
228 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
229   const std::shared_ptr<ModelAPI_Feature>& theFeature,
230   const std::list<ModelHighAPI_Selection>& theBaseObjects,
231   const ModelHighAPI_Double& theToSize,
232   const ModelHighAPI_Double& theFromSize,
233   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
234 : FeaturesAPI_ExtrusionBoolean(theFeature)
235 {
236   if(initialize()) {
237     fillAttribute(theBaseObjects, mybaseObjects);
238     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
239     fillAttribute(theToSize, mytoSize);
240     fillAttribute(theFromSize, myfromSize);
241     setBooleanObjects(theBooleanObjects);
242   }
243 }
244
245 //==================================================================================================
246 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
247   const std::shared_ptr<ModelAPI_Feature>& theFeature,
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)
253 : FeaturesAPI_ExtrusionBoolean(theFeature)
254 {
255   if(initialize()) {
256     fillAttribute(theBaseObjects, mybaseObjects);
257     fillAttribute(theDirection, mydirection);
258     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
259     fillAttribute(theToSize, mytoSize);
260     fillAttribute(theFromSize, myfromSize);
261     setBooleanObjects(theBooleanObjects);
262   }
263 }
264
265 //==================================================================================================
266 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
267   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 : FeaturesAPI_ExtrusionBoolean(theFeature)
275 {
276   if(initialize()) {
277     fillAttribute(theBaseObjects, mybaseObjects);
278     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
279     fillAttribute(theToObject, mytoObject);
280     fillAttribute(theToOffset, mytoOffset);
281     fillAttribute(theFromObject, myfromObject);
282     fillAttribute(theFromOffset, myfromOffset);
283     setBooleanObjects(theBooleanObjects);
284   }
285 }
286
287 //==================================================================================================
288 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
289   const std::shared_ptr<ModelAPI_Feature>& theFeature,
290   const std::list<ModelHighAPI_Selection>& theBaseObjects,
291   const ModelHighAPI_Selection& theDirection,
292   const ModelHighAPI_Selection& theToObject,
293   const ModelHighAPI_Double& theToOffset,
294   const ModelHighAPI_Selection& theFromObject,
295   const ModelHighAPI_Double& theFromOffset,
296   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
297 : FeaturesAPI_ExtrusionBoolean(theFeature)
298 {
299   if(initialize()) {
300     fillAttribute(theBaseObjects, mybaseObjects);
301     fillAttribute(theDirection, mydirection);
302     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
303     fillAttribute(theToObject, mytoObject);
304     fillAttribute(theToOffset, mytoOffset);
305     fillAttribute(theFromObject, myfromObject);
306     fillAttribute(theFromOffset, myfromOffset);
307     setBooleanObjects(theBooleanObjects);
308   }
309 }
310
311 //==================================================================================================
312 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
313                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
314                                 const ModelHighAPI_Double& theSize,
315                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
316 {
317   std::shared_ptr<ModelAPI_Feature> aFeature =
318     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
319   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
320                                                       theSize, theBooleanObjects));
321 }
322
323 //==================================================================================================
324 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
325                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
326                                 const ModelHighAPI_Selection& theDirection,
327                                 const ModelHighAPI_Double& theSize,
328                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
329 {
330   std::shared_ptr<ModelAPI_Feature> aFeature =
331     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
332   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection,
333                                                       theSize, theBooleanObjects));
334 }
335
336 //==================================================================================================
337 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
338                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
339                                 const ModelHighAPI_Double& theToSize,
340                                 const ModelHighAPI_Double& theFromSize,
341                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
342 {
343   std::shared_ptr<ModelAPI_Feature> aFeature =
344     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
345   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
346                                                       theToSize, theFromSize, theBooleanObjects));
347 }
348
349 //==================================================================================================
350 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
351                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
352                                 const ModelHighAPI_Selection& theDirection,
353                                 const ModelHighAPI_Double& theToSize,
354                                 const ModelHighAPI_Double& theFromSize,
355                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
356 {
357   std::shared_ptr<ModelAPI_Feature> aFeature =
358     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
359   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
360                                                       theBaseObjects,
361                                                       theDirection,
362                                                       theToSize,
363                                                       theFromSize,
364                                                       theBooleanObjects));
365 }
366
367 //==================================================================================================
368 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
369                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
370                                 const ModelHighAPI_Selection& theToObject,
371                                 const ModelHighAPI_Double& theToOffset,
372                                 const ModelHighAPI_Selection& theFromObject,
373                                 const ModelHighAPI_Double& theFromOffset,
374                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
375 {
376   std::shared_ptr<ModelAPI_Feature> aFeature =
377     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
378   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
379                                                       theBaseObjects,
380                                                       theToObject,
381                                                       theToOffset,
382                                                       theFromObject,
383                                                       theFromOffset,
384                                                       theBooleanObjects));
385 }
386
387 //==================================================================================================
388 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
389                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
390                                 const ModelHighAPI_Selection& theDirection,
391                                 const ModelHighAPI_Selection& theToObject,
392                                 const ModelHighAPI_Double& theToOffset,
393                                 const ModelHighAPI_Selection& theFromObject,
394                                 const ModelHighAPI_Double& theFromOffset,
395                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
396 {
397   std::shared_ptr<ModelAPI_Feature> aFeature =
398     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
399   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
400                                                       theBaseObjects,
401                                                       theDirection,
402                                                       theToObject,
403                                                       theToOffset,
404                                                       theFromObject,
405                                                       theFromOffset,
406                                                       theBooleanObjects));
407 }
408
409
410 //==================================================================================================
411 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
412   const std::shared_ptr<ModelAPI_Feature>& theFeature)
413 : FeaturesAPI_ExtrusionBoolean(theFeature)
414 {
415   initialize();
416 }
417
418 //==================================================================================================
419 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
420   const std::shared_ptr<ModelAPI_Feature>& theFeature,
421   const std::list<ModelHighAPI_Selection>& theBaseObjects,
422   const ModelHighAPI_Double& theSize,
423   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
424 : FeaturesAPI_ExtrusionBoolean(theFeature)
425 {
426   if(initialize()) {
427     fillAttribute(theBaseObjects, mybaseObjects);
428     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
429     fillAttribute(theSize, mytoSize);
430     fillAttribute(ModelHighAPI_Double(), myfromSize);
431     setBooleanObjects(theBooleanObjects);
432   }
433 }
434
435 //==================================================================================================
436 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
437   const std::shared_ptr<ModelAPI_Feature>& theFeature,
438   const std::list<ModelHighAPI_Selection>& theBaseObjects,
439   const ModelHighAPI_Selection& theDirection,
440   const ModelHighAPI_Double& theSize,
441   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
442 : FeaturesAPI_ExtrusionBoolean(theFeature)
443 {
444   if(initialize()) {
445     fillAttribute(theBaseObjects, mybaseObjects);
446     fillAttribute(theDirection, mydirection);
447     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
448     fillAttribute(theSize, mytoSize);
449     fillAttribute(ModelHighAPI_Double(), myfromSize);
450     setBooleanObjects(theBooleanObjects);
451   }
452 }
453
454 //==================================================================================================
455 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
456   const std::shared_ptr<ModelAPI_Feature>& theFeature,
457   const std::list<ModelHighAPI_Selection>& theBaseObjects,
458   const ModelHighAPI_Double& theToSize,
459   const ModelHighAPI_Double& theFromSize,
460   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
461 : FeaturesAPI_ExtrusionBoolean(theFeature)
462 {
463   if(initialize()) {
464     fillAttribute(theBaseObjects, mybaseObjects);
465     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
466     fillAttribute(theToSize, mytoSize);
467     fillAttribute(theFromSize, myfromSize);
468     setBooleanObjects(theBooleanObjects);
469   }
470 }
471
472 //==================================================================================================
473 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
474   const std::shared_ptr<ModelAPI_Feature>& theFeature,
475   const std::list<ModelHighAPI_Selection>& theBaseObjects,
476   const ModelHighAPI_Selection& theDirection,
477   const ModelHighAPI_Double& theToSize,
478   const ModelHighAPI_Double& theFromSize,
479   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
480 : FeaturesAPI_ExtrusionBoolean(theFeature)
481 {
482   if(initialize()) {
483     fillAttribute(theBaseObjects, mybaseObjects);
484     fillAttribute(theDirection, mydirection);
485     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
486     fillAttribute(theToSize, mytoSize);
487     fillAttribute(theFromSize, myfromSize);
488     setBooleanObjects(theBooleanObjects);
489   }
490 }
491
492 //==================================================================================================
493 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
494   const std::shared_ptr<ModelAPI_Feature>& theFeature,
495   const std::list<ModelHighAPI_Selection>& theBaseObjects,
496   const ModelHighAPI_Selection& theToObject,
497   const ModelHighAPI_Double& theToOffset,
498   const ModelHighAPI_Selection& theFromObject,
499   const ModelHighAPI_Double& theFromOffset,
500   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
501 : FeaturesAPI_ExtrusionBoolean(theFeature)
502 {
503   if(initialize()) {
504     fillAttribute(theBaseObjects, mybaseObjects);
505     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
506     fillAttribute(theToObject, mytoObject);
507     fillAttribute(theToOffset, mytoOffset);
508     fillAttribute(theFromObject, myfromObject);
509     fillAttribute(theFromOffset, myfromOffset);
510     setBooleanObjects(theBooleanObjects);
511   }
512 }
513
514 //==================================================================================================
515 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
516   const std::shared_ptr<ModelAPI_Feature>& theFeature,
517   const std::list<ModelHighAPI_Selection>& theBaseObjects,
518   const ModelHighAPI_Selection& theDirection,
519   const ModelHighAPI_Selection& theToObject,
520   const ModelHighAPI_Double& theToOffset,
521   const ModelHighAPI_Selection& theFromObject,
522   const ModelHighAPI_Double& theFromOffset,
523   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
524 : FeaturesAPI_ExtrusionBoolean(theFeature)
525 {
526   if(initialize()) {
527     fillAttribute(theBaseObjects, mybaseObjects);
528     fillAttribute(theDirection, mydirection);
529     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
530     fillAttribute(theToObject, mytoObject);
531     fillAttribute(theToOffset, mytoOffset);
532     fillAttribute(theFromObject, myfromObject);
533     fillAttribute(theFromOffset, myfromOffset);
534     setBooleanObjects(theBooleanObjects);
535   }
536 }
537
538 //==================================================================================================
539 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
540                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
541                                   const ModelHighAPI_Double& theSize,
542                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
543 {
544   std::shared_ptr<ModelAPI_Feature> aFeature =
545     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
546   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
547                                                         theSize, theBooleanObjects));
548 }
549
550 //==================================================================================================
551 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
552                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
553                                   const ModelHighAPI_Selection& theDirection,
554                                   const ModelHighAPI_Double& theSize,
555                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
556 {
557   std::shared_ptr<ModelAPI_Feature> aFeature =
558     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
559   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
560                                                         theDirection, theSize, theBooleanObjects));
561 }
562
563 //==================================================================================================
564 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
565                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
566                                   const ModelHighAPI_Double& theToSize,
567                                   const ModelHighAPI_Double& theFromSize,
568                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
569 {
570   std::shared_ptr<ModelAPI_Feature> aFeature =
571     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
572   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
573                                                         theToSize, theFromSize, theBooleanObjects));
574 }
575
576 //==================================================================================================
577 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
578                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
579                                   const ModelHighAPI_Selection& theDirection,
580                                   const ModelHighAPI_Double& theToSize,
581                                   const ModelHighAPI_Double& theFromSize,
582                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
583 {
584   std::shared_ptr<ModelAPI_Feature> aFeature =
585     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
586   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
587                                                         theBaseObjects,
588                                                         theDirection,
589                                                         theToSize,
590                                                         theFromSize,
591                                                         theBooleanObjects));
592 }
593
594 //==================================================================================================
595 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
596                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
597                                   const ModelHighAPI_Selection& theToObject,
598                                   const ModelHighAPI_Double& theToOffset,
599                                   const ModelHighAPI_Selection& theFromObject,
600                                   const ModelHighAPI_Double& theFromOffset,
601                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
602 {
603   std::shared_ptr<ModelAPI_Feature> aFeature =
604     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
605   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
606                                                         theBaseObjects,
607                                                         theToObject,
608                                                         theToOffset,
609                                                         theFromObject,
610                                                         theFromOffset,
611                                                         theBooleanObjects));
612 }
613
614 //==================================================================================================
615 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
616                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
617                                   const ModelHighAPI_Selection& theDirection,
618                                   const ModelHighAPI_Selection& theToObject,
619                                   const ModelHighAPI_Double& theToOffset,
620                                   const ModelHighAPI_Selection& theFromObject,
621                                   const ModelHighAPI_Double& theFromOffset,
622                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
623 {
624   std::shared_ptr<ModelAPI_Feature> aFeature =
625     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
626   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
627                                                         theBaseObjects,
628                                                         theDirection,
629                                                         theToObject,
630                                                         theToOffset,
631                                                         theFromObject,
632                                                         theFromOffset,
633                                                         theBooleanObjects));
634 }