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