1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_ExtrusionBoolean.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_ExtrusionBoolean.h"
9 #include <ModelHighAPI_Double.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_ExtrusionBoolean::FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
18 //==================================================================================================
19 FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean()
23 //==================================================================================================
24 void FeaturesAPI_ExtrusionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
26 fillAttribute(theBaseObjects, mybaseObjects);
31 //==================================================================================================
32 void FeaturesAPI_ExtrusionBoolean::setDirection(const ModelHighAPI_Selection& theDirection)
34 fillAttribute(theDirection, mydirection);
39 //==================================================================================================
40 void FeaturesAPI_ExtrusionBoolean::setSizes(const ModelHighAPI_Double& theToSize,
41 const ModelHighAPI_Double& theFromSize)
43 fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
44 fillAttribute(theToSize, mytoSize);
45 fillAttribute(theFromSize, myfromSize);
50 //==================================================================================================
51 void FeaturesAPI_ExtrusionBoolean::setSize(const ModelHighAPI_Double& theSize)
53 fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
54 fillAttribute(theSize, mytoSize);
55 fillAttribute(ModelHighAPI_Double(), myfromSize);
60 //==================================================================================================
61 void FeaturesAPI_ExtrusionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
62 const ModelHighAPI_Double& theToOffset,
63 const ModelHighAPI_Selection& theFromObject,
64 const ModelHighAPI_Double& theFromOffset)
66 fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
67 fillAttribute(theToObject, mytoObject);
68 fillAttribute(theToOffset, mytoOffset);
69 fillAttribute(theFromObject, myfromObject);
70 fillAttribute(theFromOffset, myfromOffset);
75 //==================================================================================================
76 void FeaturesAPI_ExtrusionBoolean::setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects)
78 fillAttribute(theBooleanObjects, mybooleanObjects);
83 //==================================================================================================
84 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
85 : FeaturesAPI_ExtrusionBoolean(theFeature)
90 //==================================================================================================
91 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
92 const std::list<ModelHighAPI_Selection>& theBaseObjects,
93 const ModelHighAPI_Double& theSize,
94 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
95 : FeaturesAPI_ExtrusionBoolean(theFeature)
98 fillAttribute(theBaseObjects, mybaseObjects);
99 fillAttribute(theSize, mytoSize);
100 fillAttribute(ModelHighAPI_Double(), myfromSize);
101 setBooleanObjects(theBooleanObjects);
105 //==================================================================================================
106 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
107 const std::list<ModelHighAPI_Selection>& theBaseObjects,
108 const ModelHighAPI_Selection& theDirection,
109 const ModelHighAPI_Double& theSize,
110 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
111 : FeaturesAPI_ExtrusionBoolean(theFeature)
114 fillAttribute(theBaseObjects, mybaseObjects);
115 fillAttribute(theDirection, mydirection);
116 fillAttribute(theSize, mytoSize);
117 fillAttribute(ModelHighAPI_Double(), myfromSize);
118 setBooleanObjects(theBooleanObjects);
122 //==================================================================================================
123 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
124 const std::list<ModelHighAPI_Selection>& theBaseObjects,
125 const ModelHighAPI_Double& theToSize,
126 const ModelHighAPI_Double& theFromSize,
127 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
128 : FeaturesAPI_ExtrusionBoolean(theFeature)
131 fillAttribute(theBaseObjects, mybaseObjects);
132 fillAttribute(theToSize, mytoSize);
133 fillAttribute(theFromSize, myfromSize);
134 setBooleanObjects(theBooleanObjects);
138 //==================================================================================================
139 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
140 const std::list<ModelHighAPI_Selection>& theBaseObjects,
141 const ModelHighAPI_Selection& theDirection,
142 const ModelHighAPI_Double& theToSize,
143 const ModelHighAPI_Double& theFromSize,
144 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
145 : FeaturesAPI_ExtrusionBoolean(theFeature)
148 fillAttribute(theBaseObjects, mybaseObjects);
149 fillAttribute(theDirection, mydirection);
150 fillAttribute(theToSize, mytoSize);
151 fillAttribute(theFromSize, myfromSize);
152 setBooleanObjects(theBooleanObjects);
156 //==================================================================================================
157 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
158 const std::list<ModelHighAPI_Selection>& theBaseObjects,
159 const ModelHighAPI_Selection& theToObject,
160 const ModelHighAPI_Double& theToOffset,
161 const ModelHighAPI_Selection& theFromObject,
162 const ModelHighAPI_Double& theFromOffset,
163 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
164 : FeaturesAPI_ExtrusionBoolean(theFeature)
167 fillAttribute(theBaseObjects, mybaseObjects);
168 fillAttribute(theToObject, mytoObject);
169 fillAttribute(theToOffset, mytoOffset);
170 fillAttribute(theFromObject, myfromObject);
171 fillAttribute(theFromOffset, myfromOffset);
172 setBooleanObjects(theBooleanObjects);
176 //==================================================================================================
177 FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
178 const std::list<ModelHighAPI_Selection>& theBaseObjects,
179 const ModelHighAPI_Selection& theDirection,
180 const ModelHighAPI_Selection& theToObject,
181 const ModelHighAPI_Double& theToOffset,
182 const ModelHighAPI_Selection& theFromObject,
183 const ModelHighAPI_Double& theFromOffset,
184 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
185 : FeaturesAPI_ExtrusionBoolean(theFeature)
188 fillAttribute(theBaseObjects, mybaseObjects);
189 fillAttribute(theDirection, mydirection);
190 fillAttribute(theToObject, mytoObject);
191 fillAttribute(theToOffset, mytoOffset);
192 fillAttribute(theFromObject, myfromObject);
193 fillAttribute(theFromOffset, myfromOffset);
194 setBooleanObjects(theBooleanObjects);
198 //==================================================================================================
199 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
200 const std::list<ModelHighAPI_Selection>& theBaseObjects,
201 const ModelHighAPI_Double& theSize,
202 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
204 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
205 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theSize, theBooleanObjects));
208 //==================================================================================================
209 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
210 const std::list<ModelHighAPI_Selection>& theBaseObjects,
211 const ModelHighAPI_Selection& theDirection,
212 const ModelHighAPI_Double& theSize,
213 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
215 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
216 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects));
219 //==================================================================================================
220 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
221 const std::list<ModelHighAPI_Selection>& theBaseObjects,
222 const ModelHighAPI_Double& theToSize,
223 const ModelHighAPI_Double& theFromSize,
224 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
226 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
227 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects));
230 //==================================================================================================
231 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
232 const std::list<ModelHighAPI_Selection>& theBaseObjects,
233 const ModelHighAPI_Selection& theDirection,
234 const ModelHighAPI_Double& theToSize,
235 const ModelHighAPI_Double& theFromSize,
236 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
238 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
239 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
247 //==================================================================================================
248 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
249 const std::list<ModelHighAPI_Selection>& theBaseObjects,
250 const ModelHighAPI_Selection& theToObject,
251 const ModelHighAPI_Double& theToOffset,
252 const ModelHighAPI_Selection& theFromObject,
253 const ModelHighAPI_Double& theFromOffset,
254 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
256 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
257 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
266 //==================================================================================================
267 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
268 const std::list<ModelHighAPI_Selection>& theBaseObjects,
269 const ModelHighAPI_Selection& theDirection,
270 const ModelHighAPI_Selection& theToObject,
271 const ModelHighAPI_Double& theToOffset,
272 const ModelHighAPI_Selection& theFromObject,
273 const ModelHighAPI_Double& theFromOffset,
274 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
276 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
277 return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
288 //==================================================================================================
289 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature)
290 : FeaturesAPI_ExtrusionBoolean(theFeature)
295 //==================================================================================================
296 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
297 const std::list<ModelHighAPI_Selection>& theBaseObjects,
298 const ModelHighAPI_Double& theSize,
299 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
300 : FeaturesAPI_ExtrusionBoolean(theFeature)
303 fillAttribute(theBaseObjects, mybaseObjects);
304 fillAttribute(theSize, mytoSize);
305 fillAttribute(ModelHighAPI_Double(), myfromSize);
306 setBooleanObjects(theBooleanObjects);
310 //==================================================================================================
311 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
312 const std::list<ModelHighAPI_Selection>& theBaseObjects,
313 const ModelHighAPI_Selection& theDirection,
314 const ModelHighAPI_Double& theSize,
315 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
316 : FeaturesAPI_ExtrusionBoolean(theFeature)
319 fillAttribute(theBaseObjects, mybaseObjects);
320 fillAttribute(theDirection, mydirection);
321 fillAttribute(theSize, mytoSize);
322 fillAttribute(ModelHighAPI_Double(), myfromSize);
323 setBooleanObjects(theBooleanObjects);
327 //==================================================================================================
328 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
329 const std::list<ModelHighAPI_Selection>& theBaseObjects,
330 const ModelHighAPI_Double& theToSize,
331 const ModelHighAPI_Double& theFromSize,
332 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
333 : FeaturesAPI_ExtrusionBoolean(theFeature)
336 fillAttribute(theBaseObjects, mybaseObjects);
337 fillAttribute(theToSize, mytoSize);
338 fillAttribute(theFromSize, myfromSize);
339 setBooleanObjects(theBooleanObjects);
343 //==================================================================================================
344 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
345 const std::list<ModelHighAPI_Selection>& theBaseObjects,
346 const ModelHighAPI_Selection& theDirection,
347 const ModelHighAPI_Double& theToSize,
348 const ModelHighAPI_Double& theFromSize,
349 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
350 : FeaturesAPI_ExtrusionBoolean(theFeature)
353 fillAttribute(theBaseObjects, mybaseObjects);
354 fillAttribute(theDirection, mydirection);
355 fillAttribute(theToSize, mytoSize);
356 fillAttribute(theFromSize, myfromSize);
357 setBooleanObjects(theBooleanObjects);
361 //==================================================================================================
362 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
363 const std::list<ModelHighAPI_Selection>& theBaseObjects,
364 const ModelHighAPI_Selection& theToObject,
365 const ModelHighAPI_Double& theToOffset,
366 const ModelHighAPI_Selection& theFromObject,
367 const ModelHighAPI_Double& theFromOffset,
368 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
369 : FeaturesAPI_ExtrusionBoolean(theFeature)
372 fillAttribute(theBaseObjects, mybaseObjects);
373 fillAttribute(theToObject, mytoObject);
374 fillAttribute(theToOffset, mytoOffset);
375 fillAttribute(theFromObject, myfromObject);
376 fillAttribute(theFromOffset, myfromOffset);
377 setBooleanObjects(theBooleanObjects);
381 //==================================================================================================
382 FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
383 const std::list<ModelHighAPI_Selection>& theBaseObjects,
384 const ModelHighAPI_Selection& theDirection,
385 const ModelHighAPI_Selection& theToObject,
386 const ModelHighAPI_Double& theToOffset,
387 const ModelHighAPI_Selection& theFromObject,
388 const ModelHighAPI_Double& theFromOffset,
389 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
390 : FeaturesAPI_ExtrusionBoolean(theFeature)
393 fillAttribute(theBaseObjects, mybaseObjects);
394 fillAttribute(theDirection, mydirection);
395 fillAttribute(theToObject, mytoObject);
396 fillAttribute(theToOffset, mytoOffset);
397 fillAttribute(theFromObject, myfromObject);
398 fillAttribute(theFromOffset, myfromOffset);
399 setBooleanObjects(theBooleanObjects);
403 //==================================================================================================
404 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
405 const std::list<ModelHighAPI_Selection>& theBaseObjects,
406 const ModelHighAPI_Double& theSize,
407 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
409 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
410 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theSize, theBooleanObjects));
413 //==================================================================================================
414 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
415 const std::list<ModelHighAPI_Selection>& theBaseObjects,
416 const ModelHighAPI_Selection& theDirection,
417 const ModelHighAPI_Double& theSize,
418 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
420 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
421 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects));
424 //==================================================================================================
425 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
426 const std::list<ModelHighAPI_Selection>& theBaseObjects,
427 const ModelHighAPI_Double& theToSize,
428 const ModelHighAPI_Double& theFromSize,
429 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
431 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
432 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects));
435 //==================================================================================================
436 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
437 const std::list<ModelHighAPI_Selection>& theBaseObjects,
438 const ModelHighAPI_Selection& theDirection,
439 const ModelHighAPI_Double& theToSize,
440 const ModelHighAPI_Double& theFromSize,
441 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
443 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
444 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
452 //==================================================================================================
453 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
454 const std::list<ModelHighAPI_Selection>& theBaseObjects,
455 const ModelHighAPI_Selection& theToObject,
456 const ModelHighAPI_Double& theToOffset,
457 const ModelHighAPI_Selection& theFromObject,
458 const ModelHighAPI_Double& theFromOffset,
459 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
461 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
462 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
471 //==================================================================================================
472 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
473 const std::list<ModelHighAPI_Selection>& theBaseObjects,
474 const ModelHighAPI_Selection& theDirection,
475 const ModelHighAPI_Selection& theToObject,
476 const ModelHighAPI_Double& theToOffset,
477 const ModelHighAPI_Selection& theFromObject,
478 const ModelHighAPI_Double& theFromOffset,
479 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
481 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
482 return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,