Salome HOME
6d6421ec24b90d164f67f9f9788efc440ba85085
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Extrusion.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef FeaturesAPI_Extrusion_H_
21 #define FeaturesAPI_Extrusion_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Extrusion.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Reference;
32 class ModelHighAPI_Selection;
33
34 /// \class FeaturesAPI_Extrusion
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Extrusion feature.
37 class FeaturesAPI_Extrusion: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
46   explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                                  const std::list<ModelHighAPI_Selection>& theBaseObjects,
48                                  const ModelHighAPI_Double& theSize);
49
50   /// Constructor with values.
51   FEATURESAPI_EXPORT
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.
57   FEATURESAPI_EXPORT
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);
62
63   /// Constructor with values.
64   FEATURESAPI_EXPORT
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());
71
72   /// Constructor with values.
73   FEATURESAPI_EXPORT
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);
80
81   /// Constructor with values.
82   FEATURESAPI_EXPORT
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());
91
92   /// Destructor.
93   FEATURESAPI_EXPORT
94   virtual ~FeaturesAPI_Extrusion();
95
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 */)
117
118   /// Modify base attribute of the feature.
119   FEATURESAPI_EXPORT
120   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
121
122   /// Modify base attribute of the feature.
123   FEATURESAPI_EXPORT
124   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
125
126   /// Modify direction_object attribute of the feature.
127   FEATURESAPI_EXPORT
128   void setDirection(const ModelHighAPI_Selection& theDirection);
129
130   /// Modify CreationMethod, to_size, from_size attributes of the feature.
131   FEATURESAPI_EXPORT
132   void setSizes(const ModelHighAPI_Double& theToSize,
133                 const ModelHighAPI_Double& theFromSize);
134
135   /// Modify creation_method, to_size, from_size attributes of the feature.
136   FEATURESAPI_EXPORT
137   void setSize(const ModelHighAPI_Double& theSize);
138
139   /// Modify creation_method, to_object, to_offset,
140   /// from_object, from_offset attributes of the feature.
141   FEATURESAPI_EXPORT
142   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
143                            const ModelHighAPI_Double& theToOffset,
144                            const ModelHighAPI_Selection& theFromObject,
145                            const ModelHighAPI_Double& theFromOffset);
146
147   /// Dump wrapped feature
148   FEATURESAPI_EXPORT
149   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
150
151 private:
152   void execIfBaseNotEmpty();
153 };
154
155 /// Pointer on Extrusion object.
156 typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
157
158 /// \ingroup CPPHighAPI
159 /// \brief Create Extrusion feature.
160 FEATURESAPI_EXPORT
161 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
162                           const std::list<ModelHighAPI_Selection>& theBaseObjects,
163                           const ModelHighAPI_Double& theSize);
164
165 /// \ingroup CPPHighAPI
166 /// \brief Create Extrusion feature.
167 FEATURESAPI_EXPORT
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);
172
173 /// \ingroup CPPHighAPI
174 /// \brief Create Extrusion feature.
175 FEATURESAPI_EXPORT
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);
180
181 /// \ingroup CPPHighAPI
182 /// \brief Create Extrusion feature.
183 FEATURESAPI_EXPORT
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());
190
191 /// \ingroup CPPHighAPI
192 /// \brief Create Extrusion feature.
193 FEATURESAPI_EXPORT
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);
200
201 /// \ingroup CPPHighAPI
202 /// \brief Create Extrusion feature.
203 FEATURESAPI_EXPORT
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());
212
213 #endif // FeaturesAPI_Extrusion_H_