Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_ExtrusionBoolean.cpp
1 // Copyright (C) 2014-2022  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
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   setSizes(theSize, ModelHighAPI_Double());
92 }
93
94 //==================================================================================================
95 void FeaturesAPI_ExtrusionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
96                                                        const ModelHighAPI_Double& theToOffset,
97                                                        const ModelHighAPI_Selection& theFromObject,
98                                                        const ModelHighAPI_Double& theFromOffset)
99 {
100   fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
101   fillAttribute(theToObject, mytoObject);
102   fillAttribute(theToOffset, mytoOffset);
103   fillAttribute(theFromObject, myfromObject);
104   fillAttribute(theFromOffset, myfromOffset);
105
106   execIfBaseNotEmpty();
107 }
108
109 //==================================================================================================
110 void FeaturesAPI_ExtrusionBoolean::setBooleanObjects(
111   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
112 {
113   fillAttribute(theBooleanObjects, mybooleanObjects);
114
115   execIfBaseNotEmpty();
116 }
117
118 //==================================================================================================
119 void FeaturesAPI_ExtrusionBoolean::dump(ModelHighAPI_Dumper& theDumper) const
120 {
121   FeaturePtr aBase = feature();
122   const std::string& aDocName = theDumper.name(aBase->document());
123
124   AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Extrusion::SKETCH_ID());
125   AttributeSelectionListPtr anAttrObjects =
126     aBase->selectionList(FeaturesPlugin_Extrusion::BASE_OBJECTS_ID());
127   AttributeSelectionPtr anAttrDirection =
128     aBase->selection(FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID());
129
130   theDumper << aBase << " = model.addExtrusion";
131   if(aBase->getKind() == FeaturesPlugin_ExtrusionCut::ID()) {
132     theDumper << "Cut";
133   } else if(aBase->getKind() == FeaturesPlugin_ExtrusionFuse::ID()) {
134     theDumper << "Fuse";
135   }
136   theDumper << "(" << aDocName << ", ";
137   anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects;
138   theDumper << ", " << anAttrDirection;
139
140   std::string aCreationMethod =
141     aBase->string(FeaturesPlugin_Extrusion::CREATION_METHOD())->value();
142
143   if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES()) {
144     AttributeDoublePtr anAttrToSize = aBase->real(FeaturesPlugin_Extrusion::TO_SIZE_ID());
145     AttributeDoublePtr anAttrFromSize = aBase->real(FeaturesPlugin_Extrusion::FROM_SIZE_ID());
146
147     theDumper << ", " << anAttrToSize << ", " << anAttrFromSize;
148   } else if(aCreationMethod == FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES()) {
149     AttributeSelectionPtr anAttrToObject =
150       aBase->selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID());
151     AttributeDoublePtr anAttrToOffset = aBase->real(FeaturesPlugin_Extrusion::TO_OFFSET_ID());
152     AttributeSelectionPtr anAttrFromObject =
153       aBase->selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
154     AttributeDoublePtr anAttrFromOffset = aBase->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID());
155
156     theDumper << ", " << anAttrToObject << ", " << anAttrToOffset <<
157       ", " << anAttrFromObject << ", " << anAttrFromOffset;
158   } else {
159     // Through all
160   }
161
162   AttributeSelectionListPtr anAttrBoolObjects =
163     aBase->selectionList(FeaturesPlugin_CompositeBoolean::OBJECTS_ID());
164   theDumper << ", " << anAttrBoolObjects << ")" << std::endl;
165
166   if(anAttrSketch->isInitialized()) {
167     theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl;
168   }
169 }
170
171 //==================================================================================================
172 void FeaturesAPI_ExtrusionBoolean::execIfBaseNotEmpty()
173 {
174   if(mybaseObjects->size() > 0) {
175     execute();
176   }
177 }
178
179
180 //==================================================================================================
181 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
182   const std::shared_ptr<ModelAPI_Feature>& theFeature)
183 : FeaturesAPI_ExtrusionBoolean(theFeature)
184 {
185   initialize();
186 }
187
188 //==================================================================================================
189 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
190   const std::shared_ptr<ModelAPI_Feature>& theFeature,
191   const std::list<ModelHighAPI_Selection>& theBaseObjects,
192   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
193 : FeaturesAPI_ExtrusionBoolean(theFeature)
194 {
195   if(initialize()) {
196     fillAttribute(theBaseObjects, mybaseObjects);
197     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod);
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_Double& theSize,
207   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
208 : FeaturesAPI_ExtrusionBoolean(theFeature)
209 {
210   if(initialize()) {
211     fillAttribute(theBaseObjects, mybaseObjects);
212     setSize(theSize);
213     setBooleanObjects(theBooleanObjects);
214   }
215 }
216
217 //==================================================================================================
218 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
219   const std::shared_ptr<ModelAPI_Feature>& theFeature,
220   const std::list<ModelHighAPI_Selection>& theBaseObjects,
221   const ModelHighAPI_Selection& theDirection,
222   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
223 : FeaturesAPI_ExtrusionBoolean(theFeature)
224 {
225   if(initialize()) {
226     fillAttribute(theBaseObjects, mybaseObjects);
227     fillAttribute(theDirection, mydirection);
228     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod);
229     setBooleanObjects(theBooleanObjects);
230   }
231 }
232
233 //==================================================================================================
234 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
235   const std::shared_ptr<ModelAPI_Feature>& theFeature,
236   const std::list<ModelHighAPI_Selection>& theBaseObjects,
237   const ModelHighAPI_Selection& theDirection,
238   const ModelHighAPI_Double& theSize,
239   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
240 : FeaturesAPI_ExtrusionBoolean(theFeature)
241 {
242   if(initialize()) {
243     fillAttribute(theBaseObjects, mybaseObjects);
244     fillAttribute(theDirection, mydirection);
245     setSize(theSize);
246     setBooleanObjects(theBooleanObjects);
247   }
248 }
249
250 //==================================================================================================
251 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
252   const std::shared_ptr<ModelAPI_Feature>& theFeature,
253   const std::list<ModelHighAPI_Selection>& theBaseObjects,
254   const ModelHighAPI_Double& theToSize,
255   const ModelHighAPI_Double& theFromSize,
256   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
257 : FeaturesAPI_ExtrusionBoolean(theFeature)
258 {
259   if(initialize()) {
260     fillAttribute(theBaseObjects, mybaseObjects);
261     setSizes(theToSize, theFromSize);
262     setBooleanObjects(theBooleanObjects);
263   }
264 }
265
266 //==================================================================================================
267 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
268   const std::shared_ptr<ModelAPI_Feature>& theFeature,
269   const std::list<ModelHighAPI_Selection>& theBaseObjects,
270   const ModelHighAPI_Selection& theDirection,
271   const ModelHighAPI_Double& theToSize,
272   const ModelHighAPI_Double& theFromSize,
273   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
274 : FeaturesAPI_ExtrusionBoolean(theFeature)
275 {
276   if(initialize()) {
277     fillAttribute(theBaseObjects, mybaseObjects);
278     fillAttribute(theDirection, mydirection);
279     setSizes(theToSize, theFromSize);
280     setBooleanObjects(theBooleanObjects);
281   }
282 }
283
284 //==================================================================================================
285 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
286   const std::shared_ptr<ModelAPI_Feature>& theFeature,
287   const std::list<ModelHighAPI_Selection>& theBaseObjects,
288   const ModelHighAPI_Selection& theToObject,
289   const ModelHighAPI_Double& theToOffset,
290   const ModelHighAPI_Selection& theFromObject,
291   const ModelHighAPI_Double& theFromOffset,
292   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
293 : FeaturesAPI_ExtrusionBoolean(theFeature)
294 {
295   if(initialize()) {
296     fillAttribute(theBaseObjects, mybaseObjects);
297     setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
298     setBooleanObjects(theBooleanObjects);
299   }
300 }
301
302 //==================================================================================================
303 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
304   const std::shared_ptr<ModelAPI_Feature>& theFeature,
305   const std::list<ModelHighAPI_Selection>& theBaseObjects,
306   const ModelHighAPI_Selection& theDirection,
307   const ModelHighAPI_Selection& theToObject,
308   const ModelHighAPI_Double& theToOffset,
309   const ModelHighAPI_Selection& theFromObject,
310   const ModelHighAPI_Double& theFromOffset,
311   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
312 : FeaturesAPI_ExtrusionBoolean(theFeature)
313 {
314   if(initialize()) {
315     fillAttribute(theBaseObjects, mybaseObjects);
316     fillAttribute(theDirection, mydirection);
317     setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
318     setBooleanObjects(theBooleanObjects);
319   }
320 }
321
322 //==================================================================================================
323 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
324                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
325                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
326 {
327   std::shared_ptr<ModelAPI_Feature> aFeature =
328     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
329   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
330                                                       theBooleanObjects));
331 }
332
333 //==================================================================================================
334 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
335                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
336                                 const ModelHighAPI_Double& theSize,
337                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
338 {
339   std::shared_ptr<ModelAPI_Feature> aFeature =
340     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
341   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
342                                                       theSize, theBooleanObjects));
343 }
344
345 //==================================================================================================
346 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
347                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
348                                 const ModelHighAPI_Selection& theDirection,
349                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
350 {
351   std::shared_ptr<ModelAPI_Feature> aFeature =
352     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
353   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection,
354                                                       theBooleanObjects));
355 }
356
357 //==================================================================================================
358 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
359                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
360                                 const ModelHighAPI_Selection& theDirection,
361                                 const ModelHighAPI_Double& theSize,
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, theBaseObjects, theDirection,
367                                                       theSize, theBooleanObjects));
368 }
369
370 //==================================================================================================
371 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
372                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
373                                 const ModelHighAPI_Double& theToSize,
374                                 const ModelHighAPI_Double& theFromSize,
375                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
376 {
377   std::shared_ptr<ModelAPI_Feature> aFeature =
378     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
379   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects,
380                                                       theToSize, theFromSize, theBooleanObjects));
381 }
382
383 //==================================================================================================
384 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
385                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
386                                 const ModelHighAPI_Selection& theDirection,
387                                 const ModelHighAPI_Double& theToSize,
388                                 const ModelHighAPI_Double& theFromSize,
389                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
390 {
391   std::shared_ptr<ModelAPI_Feature> aFeature =
392     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
393   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
394                                                       theBaseObjects,
395                                                       theDirection,
396                                                       theToSize,
397                                                       theFromSize,
398                                                       theBooleanObjects));
399 }
400
401 //==================================================================================================
402 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
403                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
404                                 const ModelHighAPI_Selection& theToObject,
405                                 const ModelHighAPI_Double& theToOffset,
406                                 const ModelHighAPI_Selection& theFromObject,
407                                 const ModelHighAPI_Double& theFromOffset,
408                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
409 {
410   std::shared_ptr<ModelAPI_Feature> aFeature =
411     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
412   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
413                                                       theBaseObjects,
414                                                       theToObject,
415                                                       theToOffset,
416                                                       theFromObject,
417                                                       theFromOffset,
418                                                       theBooleanObjects));
419 }
420
421 //==================================================================================================
422 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
423                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
424                                 const ModelHighAPI_Selection& theDirection,
425                                 const ModelHighAPI_Selection& theToObject,
426                                 const ModelHighAPI_Double& theToOffset,
427                                 const ModelHighAPI_Selection& theFromObject,
428                                 const ModelHighAPI_Double& theFromOffset,
429                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
430 {
431   std::shared_ptr<ModelAPI_Feature> aFeature =
432     thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
433   return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
434                                                       theBaseObjects,
435                                                       theDirection,
436                                                       theToObject,
437                                                       theToOffset,
438                                                       theFromObject,
439                                                       theFromOffset,
440                                                       theBooleanObjects));
441 }
442
443
444 //==================================================================================================
445 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
446   const std::shared_ptr<ModelAPI_Feature>& theFeature)
447 : FeaturesAPI_ExtrusionBoolean(theFeature)
448 {
449   initialize();
450 }
451
452 //==================================================================================================
453 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
454   const std::shared_ptr<ModelAPI_Feature>& theFeature,
455   const std::list<ModelHighAPI_Selection>& theBaseObjects,
456   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
457 : FeaturesAPI_ExtrusionBoolean(theFeature)
458 {
459   if(initialize()) {
460     fillAttribute(theBaseObjects, mybaseObjects);
461     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod);
462     setBooleanObjects(theBooleanObjects);
463   }
464 }
465
466 //==================================================================================================
467 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
468   const std::shared_ptr<ModelAPI_Feature>& theFeature,
469   const std::list<ModelHighAPI_Selection>& theBaseObjects,
470   const ModelHighAPI_Double& theSize,
471   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
472 : FeaturesAPI_ExtrusionBoolean(theFeature)
473 {
474   if(initialize()) {
475     fillAttribute(theBaseObjects, mybaseObjects);
476     setSize(theSize);
477     setBooleanObjects(theBooleanObjects);
478   }
479 }
480
481 //==================================================================================================
482 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
483   const std::shared_ptr<ModelAPI_Feature>& theFeature,
484   const std::list<ModelHighAPI_Selection>& theBaseObjects,
485   const ModelHighAPI_Selection& theDirection,
486   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
487 : FeaturesAPI_ExtrusionBoolean(theFeature)
488 {
489   if(initialize()) {
490     fillAttribute(theBaseObjects, mybaseObjects);
491     fillAttribute(theDirection, mydirection);
492     fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_THROUGH_ALL(), mycreationMethod);
493     setBooleanObjects(theBooleanObjects);
494   }
495 }
496
497 //==================================================================================================
498 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
499   const std::shared_ptr<ModelAPI_Feature>& theFeature,
500   const std::list<ModelHighAPI_Selection>& theBaseObjects,
501   const ModelHighAPI_Selection& theDirection,
502   const ModelHighAPI_Double& theSize,
503   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
504 : FeaturesAPI_ExtrusionBoolean(theFeature)
505 {
506   if(initialize()) {
507     fillAttribute(theBaseObjects, mybaseObjects);
508     fillAttribute(theDirection, mydirection);
509     setSize(theSize);
510     setBooleanObjects(theBooleanObjects);
511   }
512 }
513
514 //==================================================================================================
515 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
516   const std::shared_ptr<ModelAPI_Feature>& theFeature,
517   const std::list<ModelHighAPI_Selection>& theBaseObjects,
518   const ModelHighAPI_Double& theToSize,
519   const ModelHighAPI_Double& theFromSize,
520   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
521 : FeaturesAPI_ExtrusionBoolean(theFeature)
522 {
523   if(initialize()) {
524     fillAttribute(theBaseObjects, mybaseObjects);
525     setSizes(theToSize, theFromSize);
526     setBooleanObjects(theBooleanObjects);
527   }
528 }
529
530 //==================================================================================================
531 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
532   const std::shared_ptr<ModelAPI_Feature>& theFeature,
533   const std::list<ModelHighAPI_Selection>& theBaseObjects,
534   const ModelHighAPI_Selection& theDirection,
535   const ModelHighAPI_Double& theToSize,
536   const ModelHighAPI_Double& theFromSize,
537   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
538 : FeaturesAPI_ExtrusionBoolean(theFeature)
539 {
540   if(initialize()) {
541     fillAttribute(theBaseObjects, mybaseObjects);
542     fillAttribute(theDirection, mydirection);
543     setSizes(theToSize, theFromSize);
544     setBooleanObjects(theBooleanObjects);
545   }
546 }
547
548 //==================================================================================================
549 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
550   const std::shared_ptr<ModelAPI_Feature>& theFeature,
551   const std::list<ModelHighAPI_Selection>& theBaseObjects,
552   const ModelHighAPI_Selection& theToObject,
553   const ModelHighAPI_Double& theToOffset,
554   const ModelHighAPI_Selection& theFromObject,
555   const ModelHighAPI_Double& theFromOffset,
556   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
557 : FeaturesAPI_ExtrusionBoolean(theFeature)
558 {
559   if(initialize()) {
560     fillAttribute(theBaseObjects, mybaseObjects);
561     setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
562     setBooleanObjects(theBooleanObjects);
563   }
564 }
565
566 //==================================================================================================
567 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
568   const std::shared_ptr<ModelAPI_Feature>& theFeature,
569   const std::list<ModelHighAPI_Selection>& theBaseObjects,
570   const ModelHighAPI_Selection& theDirection,
571   const ModelHighAPI_Selection& theToObject,
572   const ModelHighAPI_Double& theToOffset,
573   const ModelHighAPI_Selection& theFromObject,
574   const ModelHighAPI_Double& theFromOffset,
575   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
576 : FeaturesAPI_ExtrusionBoolean(theFeature)
577 {
578   if(initialize()) {
579     fillAttribute(theBaseObjects, mybaseObjects);
580     fillAttribute(theDirection, mydirection);
581     setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
582     setBooleanObjects(theBooleanObjects);
583   }
584 }
585
586 //==================================================================================================
587 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
588                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
589                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
590 {
591   std::shared_ptr<ModelAPI_Feature> aFeature =
592     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
593   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
594                                                         theBooleanObjects));
595 }
596
597 //==================================================================================================
598 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
599                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
600                                   const ModelHighAPI_Double& theSize,
601                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
602 {
603   std::shared_ptr<ModelAPI_Feature> aFeature =
604     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
605   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
606                                                         theSize, theBooleanObjects));
607 }
608
609 //==================================================================================================
610 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
611                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
612                                   const ModelHighAPI_Selection& theDirection,
613                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
614 {
615   std::shared_ptr<ModelAPI_Feature> aFeature =
616     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
617   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
618                                                         theDirection, theBooleanObjects));
619 }
620
621 //==================================================================================================
622 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
623                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
624                                   const ModelHighAPI_Selection& theDirection,
625                                   const ModelHighAPI_Double& theSize,
626                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
627 {
628   std::shared_ptr<ModelAPI_Feature> aFeature =
629     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
630   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
631                                                         theDirection, theSize, theBooleanObjects));
632 }
633
634 //==================================================================================================
635 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
636                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
637                                   const ModelHighAPI_Double& theToSize,
638                                   const ModelHighAPI_Double& theFromSize,
639                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
640 {
641   std::shared_ptr<ModelAPI_Feature> aFeature =
642     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
643   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects,
644                                                         theToSize, theFromSize, theBooleanObjects));
645 }
646
647 //==================================================================================================
648 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
649                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
650                                   const ModelHighAPI_Selection& theDirection,
651                                   const ModelHighAPI_Double& theToSize,
652                                   const ModelHighAPI_Double& theFromSize,
653                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
654 {
655   std::shared_ptr<ModelAPI_Feature> aFeature =
656     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
657   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
658                                                         theBaseObjects,
659                                                         theDirection,
660                                                         theToSize,
661                                                         theFromSize,
662                                                         theBooleanObjects));
663 }
664
665 //==================================================================================================
666 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
667                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
668                                   const ModelHighAPI_Selection& theToObject,
669                                   const ModelHighAPI_Double& theToOffset,
670                                   const ModelHighAPI_Selection& theFromObject,
671                                   const ModelHighAPI_Double& theFromOffset,
672                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
673 {
674   std::shared_ptr<ModelAPI_Feature> aFeature =
675     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
676   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
677                                                         theBaseObjects,
678                                                         theToObject,
679                                                         theToOffset,
680                                                         theFromObject,
681                                                         theFromOffset,
682                                                         theBooleanObjects));
683 }
684
685 //==================================================================================================
686 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
687                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
688                                   const ModelHighAPI_Selection& theDirection,
689                                   const ModelHighAPI_Selection& theToObject,
690                                   const ModelHighAPI_Double& theToOffset,
691                                   const ModelHighAPI_Selection& theFromObject,
692                                   const ModelHighAPI_Double& theFromOffset,
693                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
694 {
695   std::shared_ptr<ModelAPI_Feature> aFeature =
696     thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
697   return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
698                                                         theBaseObjects,
699                                                         theDirection,
700                                                         theToObject,
701                                                         theToOffset,
702                                                         theFromObject,
703                                                         theFromOffset,
704                                                         theBooleanObjects));
705 }