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