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