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