1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FeaturesAPI_ExtrusionBoolean_H_
22 #define FeaturesAPI_ExtrusionBoolean_H_
24 #include "FeaturesAPI.h"
26 #include <FeaturesPlugin_ExtrusionCut.h>
27 #include <FeaturesPlugin_ExtrusionFuse.h>
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
32 class ModelHighAPI_Double;
33 class ModelHighAPI_Reference;
34 class ModelHighAPI_Selection;
36 /// \class FeaturesAPI_ExtrusionBoolean
37 /// \ingroup CPPHighAPI
38 /// \brief Interface for ExtrusionBoolean feature.
39 class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface
44 virtual ~FeaturesAPI_ExtrusionBoolean();
47 sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
48 ModelAPI_AttributeReference, /** Sketch launcher */,
49 baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
50 ModelAPI_AttributeSelectionList, /** Base objects */,
51 direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
52 ModelAPI_AttributeSelection, /** Direction */,
53 creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
54 ModelAPI_AttributeString, /** Creation method */,
55 toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
56 ModelAPI_AttributeDouble, /** To size */,
57 fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
58 ModelAPI_AttributeDouble, /** From size */,
59 toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
60 ModelAPI_AttributeSelection, /** To object */,
61 toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
62 ModelAPI_AttributeDouble, /** To offset */,
63 fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
64 ModelAPI_AttributeSelection, /** From object */,
65 fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
66 ModelAPI_AttributeDouble, /** From offset */,
67 booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
68 ModelAPI_AttributeSelectionList, /** Boolean objects */)
70 /// Modify base attribute of the feature.
72 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
74 /// Modify base attribute of the feature.
76 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
78 /// Modify direction_object attribute of the feature.
80 void setDirection(const ModelHighAPI_Selection& theDirection);
82 /// Modify CreationMethod, to_size, from_size attributes of the feature.
84 void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
86 /// Modify creation_method, to_size, from_size attributes of the feature.
88 void setSize(const ModelHighAPI_Double& theSize);
90 /// Modify creation_method, to_object, to_offset, from_object,
91 /// from_offset attributes of the feature.
93 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
94 const ModelHighAPI_Double& theToOffset,
95 const ModelHighAPI_Selection& theFromObject,
96 const ModelHighAPI_Double& theFromOffset);
98 /// Modiyfy main_objects attribute of the feature.
100 void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
102 /// Dump wrapped feature
104 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
107 /// Constructor without values.
109 explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
112 void execIfBaseNotEmpty();
115 /// \class FeaturesAPI_ExtrusionCut
116 /// \ingroup CPPHighAPI
117 /// \brief Interface for ExtrusionCut feature.
118 class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
122 static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
123 virtual std::string getID() { return ID(); }
126 //virtual std::string getID() {
127 // return FeaturesPlugin_ExtrusionCut::ID();
130 /// Constructor without values.
132 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
134 /// Constructor with values.
136 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
137 const std::list<ModelHighAPI_Selection>& theBaseObjects,
138 const ModelHighAPI_Double& theSize,
139 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
141 /// Constructor with values.
143 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
144 const std::list<ModelHighAPI_Selection>& theBaseObjects,
145 const ModelHighAPI_Selection& theDirection,
146 const ModelHighAPI_Double& theSize,
147 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
149 /// Constructor with values.
151 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
152 const std::list<ModelHighAPI_Selection>& theBaseObjects,
153 const ModelHighAPI_Double& theToSize,
154 const ModelHighAPI_Double& theFromSize,
155 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
157 /// Constructor with values.
159 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
160 const std::list<ModelHighAPI_Selection>& theBaseObjects,
161 const ModelHighAPI_Selection& theDirection,
162 const ModelHighAPI_Double& theToSize,
163 const ModelHighAPI_Double& theFromSize,
164 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
166 /// Constructor with values.
168 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
169 const std::list<ModelHighAPI_Selection>& theBaseObjects,
170 const ModelHighAPI_Selection& theToObject,
171 const ModelHighAPI_Double& theToOffset,
172 const ModelHighAPI_Selection& theFromObject,
173 const ModelHighAPI_Double& theFromOffset,
174 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
176 /// Constructor with values.
178 explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
179 const std::list<ModelHighAPI_Selection>& theBaseObjects,
180 const ModelHighAPI_Selection& theDirection,
181 const ModelHighAPI_Selection& theToObject,
182 const ModelHighAPI_Double& theToOffset,
183 const ModelHighAPI_Selection& theFromObject,
184 const ModelHighAPI_Double& theFromOffset,
185 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
188 /// Pointer on ExtrusionCut object.
189 typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
191 /// \ingroup CPPHighAPI
192 /// \brief Create ExtrusionCut feature.
194 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
195 const std::list<ModelHighAPI_Selection>& theBaseObjects,
196 const ModelHighAPI_Double& theSize,
197 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
199 /// \ingroup CPPHighAPI
200 /// \brief Create ExtrusionCut feature.
202 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
203 const std::list<ModelHighAPI_Selection>& theBaseObjects,
204 const ModelHighAPI_Selection& theDirection,
205 const ModelHighAPI_Double& theSize,
206 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
208 /// \ingroup CPPHighAPI
209 /// \brief Create ExtrusionCut feature.
211 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
212 const std::list<ModelHighAPI_Selection>& theBaseObjects,
213 const ModelHighAPI_Double& theToSize,
214 const ModelHighAPI_Double& theFromSize,
215 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
217 /// \ingroup CPPHighAPI
218 /// \brief Create ExtrusionCut feature.
220 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
221 const std::list<ModelHighAPI_Selection>& theBaseObjects,
222 const ModelHighAPI_Selection& theDirection,
223 const ModelHighAPI_Double& theToSize,
224 const ModelHighAPI_Double& theFromSize,
225 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
227 /// \ingroup CPPHighAPI
228 /// \brief Create ExtrusionCut feature.
230 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
231 const std::list<ModelHighAPI_Selection>& theBaseObjects,
232 const ModelHighAPI_Selection& theToObject,
233 const ModelHighAPI_Double& theToOffset,
234 const ModelHighAPI_Selection& theFromObject,
235 const ModelHighAPI_Double& theFromOffset,
236 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
238 /// \ingroup CPPHighAPI
239 /// \brief Create ExtrusionCut feature.
241 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
242 const std::list<ModelHighAPI_Selection>& theBaseObjects,
243 const ModelHighAPI_Selection& theDirection,
244 const ModelHighAPI_Selection& theToObject,
245 const ModelHighAPI_Double& theToOffset,
246 const ModelHighAPI_Selection& theFromObject,
247 const ModelHighAPI_Double& theFromOffset,
248 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
250 /// \class FeaturesAPI_ExtrusionFuse
251 /// \ingroup CPPHighAPI
252 /// \brief Interface for ExtrusionFuse feature.
253 class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
256 static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); }
257 virtual std::string getID() { return ID(); }
259 /// Constructor without values.
261 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
263 /// Constructor with values.
265 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
266 const std::list<ModelHighAPI_Selection>& theBaseObjects,
267 const ModelHighAPI_Double& theSize,
268 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
270 /// Constructor with values.
272 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
273 const std::list<ModelHighAPI_Selection>& theBaseObjects,
274 const ModelHighAPI_Selection& theDirection,
275 const ModelHighAPI_Double& theSize,
276 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
278 /// Constructor with values.
280 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
281 const std::list<ModelHighAPI_Selection>& theBaseObjects,
282 const ModelHighAPI_Double& theToSize,
283 const ModelHighAPI_Double& theFromSize,
284 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
286 /// Constructor with values.
288 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
289 const std::list<ModelHighAPI_Selection>& theBaseObjects,
290 const ModelHighAPI_Selection& theDirection,
291 const ModelHighAPI_Double& theToSize,
292 const ModelHighAPI_Double& theFromSize,
293 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
295 /// Constructor with values.
297 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
298 const std::list<ModelHighAPI_Selection>& theBaseObjects,
299 const ModelHighAPI_Selection& theToObject,
300 const ModelHighAPI_Double& theToOffset,
301 const ModelHighAPI_Selection& theFromObject,
302 const ModelHighAPI_Double& theFromOffset,
303 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
305 /// Constructor with values.
307 explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
308 const std::list<ModelHighAPI_Selection>& theBaseObjects,
309 const ModelHighAPI_Selection& theDirection,
310 const ModelHighAPI_Selection& theToObject,
311 const ModelHighAPI_Double& theToOffset,
312 const ModelHighAPI_Selection& theFromObject,
313 const ModelHighAPI_Double& theFromOffset,
314 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
317 /// Pointer on ExtrusionFuse object.
318 typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
320 /// \ingroup CPPHighAPI
321 /// \brief Create ExtrusionFuse feature.
323 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
324 const std::list<ModelHighAPI_Selection>& theBaseObjects,
325 const ModelHighAPI_Double& theSize,
326 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
328 /// \ingroup CPPHighAPI
329 /// \brief Create ExtrusionFuse feature.
331 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
332 const std::list<ModelHighAPI_Selection>& theBaseObjects,
333 const ModelHighAPI_Selection& theDirection,
334 const ModelHighAPI_Double& theSize,
335 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
337 /// \ingroup CPPHighAPI
338 /// \brief Create ExtrusionFuse feature.
340 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
341 const std::list<ModelHighAPI_Selection>& theBaseObjects,
342 const ModelHighAPI_Double& theToSize,
343 const ModelHighAPI_Double& theFromSize,
344 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
346 /// \ingroup CPPHighAPI
347 /// \brief Create ExtrusionFuse feature.
349 ExtrusionFusePtr addExtrusionFuse(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);
356 /// \ingroup CPPHighAPI
357 /// \brief Create ExtrusionFuse feature.
359 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
360 const std::list<ModelHighAPI_Selection>& theBaseObjects,
361 const ModelHighAPI_Selection& theToObject,
362 const ModelHighAPI_Double& theToOffset,
363 const ModelHighAPI_Selection& theFromObject,
364 const ModelHighAPI_Double& theFromOffset,
365 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
367 /// \ingroup CPPHighAPI
368 /// \brief Create ExtrusionFuse feature.
370 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
371 const std::list<ModelHighAPI_Selection>& theBaseObjects,
372 const ModelHighAPI_Selection& theDirection,
373 const ModelHighAPI_Selection& theToObject,
374 const ModelHighAPI_Double& theToOffset,
375 const ModelHighAPI_Selection& theFromObject,
376 const ModelHighAPI_Double& theFromOffset,
377 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
379 #endif // FeaturesAPI_ExtrusionBoolean_H_