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