1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: FeaturesPlugin_CompositeSketch.h
4 // Created: 11 September 2015
5 // Author: Dmitry Bobylev
7 #ifndef FeaturesPlugin_CompositeSketch_H_
8 #define FeaturesPlugin_CompositeSketch_H_
10 #include <FeaturesPlugin.h>
12 #include <ModelAPI_CompositeFeature.h>
14 #include <GeomAlgoAPI_Boolean.h>
16 /** \class FeaturesPlugin_CompositeSketch
18 * \brief Interface for the composite sketch feature.
20 class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature
23 /// Attribute name of sketch feature.
24 inline static const std::string& SKETCH_OBJECT_ID()
26 static const std::string MY_SKETCH_OBJECT_ID("sketch");
27 return MY_SKETCH_OBJECT_ID;
30 /// Attribute name of sketch feature selection: needed for naming of the selected sketch.
31 inline static const std::string& SKETCH_SELECTION_ID()
33 static const std::string MY_SKETCH_SELECTION_ID("sketch_selection");
34 return MY_SKETCH_SELECTION_ID;
37 /// Creates a new part document if needed.
38 FEATURESPLUGIN_EXPORT virtual void execute();
40 /// Request for initialization of data model of the feature: adding all attributes.
41 FEATURESPLUGIN_EXPORT virtual void initAttributes();
43 /// Appends a feature to the sketch sub-elements container.
44 FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
46 /// \return the number of sub-elements.
47 FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
49 /// \return the sub-feature by zero-base index.
50 FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
52 /// \return the sub-feature unique identifier in this composite feature by zero-base index.
53 FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
55 /// \return true if feature or result belong to this composite feature as subs.
56 FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
58 /// This method to inform that sub-feature is removed and must be removed from the internal data
59 /// structures of the owner (the remove from the document will be done outside just after)
60 FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
62 /// removes also all sub-sketch
63 FEATURESPLUGIN_EXPORT virtual void erase();
66 FeaturesPlugin_CompositeSketch(){};
68 /// Define this function to init attributes for extrusion/revolution.
69 virtual void initMakeSolidsAttributes() = 0;
71 /// Define this function to create solids from faces with extrusion/revolution.
72 virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
73 std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape) = 0;
76 void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
77 const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
78 const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);