1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: FeaturesPlugin_CompositeBoolean.h
4 // Created: 11 June 2015
5 // Author: Dmitry Bobylev
7 #ifndef FeaturesPlugin_CompositeBoolean_H_
8 #define FeaturesPlugin_CompositeBoolean_H_
10 #include <FeaturesPlugin.h>
12 #include <ModelAPI_CompositeFeature.h>
14 #include <GeomAlgoAPI_Boolean.h>
16 /** \class FeaturesPlugin_CompositeBoolean
19 class FeaturesPlugin_CompositeBoolean : public ModelAPI_CompositeFeature
22 /// Attribute name of sketch feature.
23 inline static const std::string& SKETCH_OBJECT_ID()
25 static const std::string MY_SKETCH_OBJECT_ID("sketch");
26 return MY_SKETCH_OBJECT_ID;
29 /// Attribute name of objects for boolean operation.
30 inline static const std::string& BOOLEAN_OBJECTS_ID()
32 static const std::string MY_BOOLEAN_OBJECTS_ID("boolean_objects");
33 return MY_BOOLEAN_OBJECTS_ID;
36 /// Creates a new part document if needed.
37 FEATURESPLUGIN_EXPORT virtual void execute();
39 /// Request for initialization of data model of the feature: adding all attributes.
40 FEATURESPLUGIN_EXPORT virtual void initAttributes();
42 /// Appends a feature to the sketch sub-elements container.
43 FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
45 /// \return the number of sub-elements.
46 FEATURESPLUGIN_EXPORT virtual int numberOfSubs() const;
48 /// \return the sub-feature by zero-base index.
49 FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex) const;
51 /// \return the sub-feature unique identifier in this composite feature by zero-base index.
52 FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
54 /// \return true if feature or reuslt belong to this composite feature as subs.
55 FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
57 /// This method to inform that sub-feature is removed and must be removed from the internal data
58 /// structures of the owner (the remove from the document will be done outside just after)
59 FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
62 FeaturesPlugin_CompositeBoolean(){};
64 /// Define this function to init attributes for extrusion/revolution.
65 virtual void initMakeSolidsAttributes() = 0;
67 /// Define this function to create solids from faces with extrusion/revolution.
68 virtual ListOfShape MakeSolids(const ListOfShape& theFaces) = 0;
70 void LoadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
71 const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
72 const ListOfShape& theTools,
73 const GeomAlgoAPI_Boolean& theAlgo);
76 GeomAlgoAPI_Boolean::OperationType myBooleanOperationType;