1 // Copyright (C) 2014-2021 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 email : webmaster.salome@opencascade.com
20 #ifndef FeaturesAPI_Extrusion_H_
21 #define FeaturesAPI_Extrusion_H_
23 #include "FeaturesAPI.h"
25 #include <FeaturesPlugin_Extrusion.h>
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Reference;
32 class ModelHighAPI_Selection;
34 /// \class FeaturesAPI_Extrusion
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Extrusion feature.
37 class FeaturesAPI_Extrusion: public ModelHighAPI_Interface
40 /// Constructor without values.
42 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature);
44 /// Constructor with values.
46 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47 const std::list<ModelHighAPI_Selection>& theBaseObjects,
48 const ModelHighAPI_Double& theSize);
50 /// Constructor with values.
52 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
53 const std::list<ModelHighAPI_Selection>& theBaseObjects,
54 const ModelHighAPI_Selection& theDirection,
55 const ModelHighAPI_Double& theSize);
56 /// Constructor with values.
58 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
59 const std::list<ModelHighAPI_Selection>& theBaseObjects,
60 const ModelHighAPI_Double& theToSize,
61 const ModelHighAPI_Double& theFromSize);
63 /// Constructor with values.
65 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
66 const std::list<ModelHighAPI_Selection>& theBaseObjects,
67 const ModelHighAPI_Selection& theDirection,
68 const ModelHighAPI_Double& theToSize,
69 const ModelHighAPI_Double& theFromSize,
70 const std::string& theSelectionType = std::string());
72 /// Constructor with values.
74 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
75 const std::list<ModelHighAPI_Selection>& theBaseObjects,
76 const ModelHighAPI_Selection& theToObject,
77 const ModelHighAPI_Double& theToOffset,
78 const ModelHighAPI_Selection& theFromObject,
79 const ModelHighAPI_Double& theFromOffset);
81 /// Constructor with values.
83 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
84 const std::list<ModelHighAPI_Selection>& theBaseObjects,
85 const ModelHighAPI_Selection& theDirection,
86 const ModelHighAPI_Selection& theToObject,
87 const ModelHighAPI_Double& theToOffset,
88 const ModelHighAPI_Selection& theFromObject,
89 const ModelHighAPI_Double& theFromOffset,
90 const std::string& theSelectionType = std::string());
94 virtual ~FeaturesAPI_Extrusion();
96 INTERFACE_10(FeaturesPlugin_Extrusion::ID(),
97 sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
98 ModelAPI_AttributeReference, /** Sketch launcher */,
99 baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
100 ModelAPI_AttributeSelectionList, /** Base objects */,
101 direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
102 ModelAPI_AttributeSelection, /** Direction */,
103 creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
104 ModelAPI_AttributeString, /** Creation method */,
105 toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
106 ModelAPI_AttributeDouble, /** To size */,
107 fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
108 ModelAPI_AttributeDouble, /** From size */,
109 toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
110 ModelAPI_AttributeSelection, /** To object */,
111 toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
112 ModelAPI_AttributeDouble, /** To offset */,
113 fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
114 ModelAPI_AttributeSelection, /** From object */,
115 fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
116 ModelAPI_AttributeDouble, /** From offset */)
118 /// Modify base attribute of the feature.
120 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
122 /// Modify base attribute of the feature.
124 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
126 /// Modify direction_object attribute of the feature.
128 void setDirection(const ModelHighAPI_Selection& theDirection);
130 /// Modify CreationMethod, to_size, from_size attributes of the feature.
132 void setSizes(const ModelHighAPI_Double& theToSize,
133 const ModelHighAPI_Double& theFromSize);
135 /// Modify creation_method, to_size, from_size attributes of the feature.
137 void setSize(const ModelHighAPI_Double& theSize);
139 /// Modify creation_method, to_object, to_offset,
140 /// from_object, from_offset attributes of the feature.
142 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
143 const ModelHighAPI_Double& theToOffset,
144 const ModelHighAPI_Selection& theFromObject,
145 const ModelHighAPI_Double& theFromOffset);
147 /// Dump wrapped feature
149 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
152 void execIfBaseNotEmpty();
155 /// Pointer on Extrusion object.
156 typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
158 /// \ingroup CPPHighAPI
159 /// \brief Create Extrusion feature.
161 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
162 const std::list<ModelHighAPI_Selection>& theBaseObjects,
163 const ModelHighAPI_Double& theSize);
165 /// \ingroup CPPHighAPI
166 /// \brief Create Extrusion feature.
168 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
169 const std::list<ModelHighAPI_Selection>& theBaseObjects,
170 const ModelHighAPI_Selection& theDirection,
171 const ModelHighAPI_Double& theSize);
173 /// \ingroup CPPHighAPI
174 /// \brief Create Extrusion feature.
176 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
177 const std::list<ModelHighAPI_Selection>& theBaseObjects,
178 const ModelHighAPI_Double& theToSize,
179 const ModelHighAPI_Double& theFromSize);
181 /// \ingroup CPPHighAPI
182 /// \brief Create Extrusion feature.
184 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
185 const std::list<ModelHighAPI_Selection>& theBaseObjects,
186 const ModelHighAPI_Selection& theDirection,
187 const ModelHighAPI_Double& theToSize,
188 const ModelHighAPI_Double& theFromSize,
189 const std::string& theSelectionType = std::string());
191 /// \ingroup CPPHighAPI
192 /// \brief Create Extrusion feature.
194 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
195 const std::list<ModelHighAPI_Selection>& theBaseObjects,
196 const ModelHighAPI_Selection& theToObject,
197 const ModelHighAPI_Double& theToOffset,
198 const ModelHighAPI_Selection& theFromObject,
199 const ModelHighAPI_Double& theFromOffset);
201 /// \ingroup CPPHighAPI
202 /// \brief Create Extrusion feature.
204 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
205 const std::list<ModelHighAPI_Selection>& theBaseObjects,
206 const ModelHighAPI_Selection& theDirection,
207 const ModelHighAPI_Selection& theToObject,
208 const ModelHighAPI_Double& theToOffset,
209 const ModelHighAPI_Selection& theFromObject,
210 const ModelHighAPI_Double& theFromOffset,
211 const std::string& theSelectionType = std::string());
213 #endif // FeaturesAPI_Extrusion_H_