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