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