1 // Copyright (C) 2014-2019 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);
71 /// Constructor with values.
73 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
74 const std::list<ModelHighAPI_Selection>& theBaseObjects,
75 const ModelHighAPI_Selection& theToObject,
76 const ModelHighAPI_Double& theToOffset,
77 const ModelHighAPI_Selection& theFromObject,
78 const ModelHighAPI_Double& theFromOffset);
80 /// Constructor with values.
82 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
83 const std::list<ModelHighAPI_Selection>& theBaseObjects,
84 const ModelHighAPI_Selection& theDirection,
85 const ModelHighAPI_Selection& theToObject,
86 const ModelHighAPI_Double& theToOffset,
87 const ModelHighAPI_Selection& theFromObject,
88 const ModelHighAPI_Double& theFromOffset);
92 virtual ~FeaturesAPI_Extrusion();
94 INTERFACE_10(FeaturesPlugin_Extrusion::ID(),
95 sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
96 ModelAPI_AttributeReference, /** Sketch launcher */,
97 baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
98 ModelAPI_AttributeSelectionList, /** Base objects */,
99 direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
100 ModelAPI_AttributeSelection, /** Direction */,
101 creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
102 ModelAPI_AttributeString, /** Creation method */,
103 toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
104 ModelAPI_AttributeDouble, /** To size */,
105 fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
106 ModelAPI_AttributeDouble, /** From size */,
107 toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
108 ModelAPI_AttributeSelection, /** To object */,
109 toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
110 ModelAPI_AttributeDouble, /** To offset */,
111 fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
112 ModelAPI_AttributeSelection, /** From object */,
113 fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
114 ModelAPI_AttributeDouble, /** From offset */)
116 /// Modify base attribute of the feature.
118 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
120 /// Modify base attribute of the feature.
122 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
124 /// Modify direction_object attribute of the feature.
126 void setDirection(const ModelHighAPI_Selection& theDirection);
128 /// Modify CreationMethod, to_size, from_size attributes of the feature.
130 void setSizes(const ModelHighAPI_Double& theToSize,
131 const ModelHighAPI_Double& theFromSize);
133 /// Modify creation_method, to_size, from_size attributes of the feature.
135 void setSize(const ModelHighAPI_Double& theSize);
137 /// Modify creation_method, to_object, to_offset,
138 /// from_object, from_offset attributes of the feature.
140 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
141 const ModelHighAPI_Double& theToOffset,
142 const ModelHighAPI_Selection& theFromObject,
143 const ModelHighAPI_Double& theFromOffset);
145 /// Dump wrapped feature
147 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
150 void execIfBaseNotEmpty();
153 /// Pointer on Extrusion object.
154 typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
156 /// \ingroup CPPHighAPI
157 /// \brief Create Extrusion feature.
159 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
160 const std::list<ModelHighAPI_Selection>& theBaseObjects,
161 const ModelHighAPI_Double& theSize);
163 /// \ingroup CPPHighAPI
164 /// \brief Create Extrusion feature.
166 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
167 const std::list<ModelHighAPI_Selection>& theBaseObjects,
168 const ModelHighAPI_Selection& theDirection,
169 const ModelHighAPI_Double& theSize);
171 /// \ingroup CPPHighAPI
172 /// \brief Create Extrusion feature.
174 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
175 const std::list<ModelHighAPI_Selection>& theBaseObjects,
176 const ModelHighAPI_Double& theToSize,
177 const ModelHighAPI_Double& theFromSize);
179 /// \ingroup CPPHighAPI
180 /// \brief Create Extrusion feature.
182 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
183 const std::list<ModelHighAPI_Selection>& theBaseObjects,
184 const ModelHighAPI_Selection& theDirection,
185 const ModelHighAPI_Double& theToSize,
186 const ModelHighAPI_Double& theFromSize);
188 /// \ingroup CPPHighAPI
189 /// \brief Create Extrusion feature.
191 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
192 const std::list<ModelHighAPI_Selection>& theBaseObjects,
193 const ModelHighAPI_Selection& theToObject,
194 const ModelHighAPI_Double& theToOffset,
195 const ModelHighAPI_Selection& theFromObject,
196 const ModelHighAPI_Double& theFromOffset);
198 /// \ingroup CPPHighAPI
199 /// \brief Create Extrusion feature.
201 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
202 const std::list<ModelHighAPI_Selection>& theBaseObjects,
203 const ModelHighAPI_Selection& theDirection,
204 const ModelHighAPI_Selection& theToObject,
205 const ModelHighAPI_Double& theToOffset,
206 const ModelHighAPI_Selection& theFromObject,
207 const ModelHighAPI_Double& theFromOffset);
209 #endif // FeaturesAPI_Extrusion_H_