1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FeaturesAPI_Extrusion_H_
22 #define FeaturesAPI_Extrusion_H_
24 #include "FeaturesAPI.h"
26 #include <FeaturesPlugin_Extrusion.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
31 class ModelHighAPI_Double;
32 class ModelHighAPI_Reference;
33 class ModelHighAPI_Selection;
35 /// \class FeaturesAPI_Extrusion
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for Extrusion feature.
38 class FeaturesAPI_Extrusion: public ModelHighAPI_Interface
41 /// Constructor without values.
43 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature);
45 /// Constructor with values.
47 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
48 const std::list<ModelHighAPI_Selection>& theBaseObjects,
49 const ModelHighAPI_Double& theSize);
51 /// Constructor with values.
53 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54 const std::list<ModelHighAPI_Selection>& theBaseObjects,
55 const ModelHighAPI_Selection& theDirection,
56 const ModelHighAPI_Double& theSize);
57 /// Constructor with values.
59 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
60 const std::list<ModelHighAPI_Selection>& theBaseObjects,
61 const ModelHighAPI_Double& theToSize,
62 const ModelHighAPI_Double& theFromSize);
64 /// Constructor with values.
66 explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
67 const std::list<ModelHighAPI_Selection>& theBaseObjects,
68 const ModelHighAPI_Selection& theDirection,
69 const ModelHighAPI_Double& theToSize,
70 const ModelHighAPI_Double& theFromSize);
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);
93 virtual ~FeaturesAPI_Extrusion();
95 INTERFACE_10(FeaturesPlugin_Extrusion::ID(),
96 sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
97 ModelAPI_AttributeReference, /** Sketch launcher */,
98 baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
99 ModelAPI_AttributeSelectionList, /** Base objects */,
100 direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
101 ModelAPI_AttributeSelection, /** Direction */,
102 creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
103 ModelAPI_AttributeString, /** Creation method */,
104 toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
105 ModelAPI_AttributeDouble, /** To size */,
106 fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
107 ModelAPI_AttributeDouble, /** From size */,
108 toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
109 ModelAPI_AttributeSelection, /** To object */,
110 toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
111 ModelAPI_AttributeDouble, /** To offset */,
112 fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
113 ModelAPI_AttributeSelection, /** From object */,
114 fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
115 ModelAPI_AttributeDouble, /** From offset */)
117 /// Modify base attribute of the feature.
119 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
121 /// Modify base attribute of the feature.
123 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
125 /// Modify direction_object attribute of the feature.
127 void setDirection(const ModelHighAPI_Selection& theDirection);
129 /// Modify CreationMethod, to_size, from_size attributes of the feature.
131 void setSizes(const ModelHighAPI_Double& theToSize,
132 const ModelHighAPI_Double& theFromSize);
134 /// Modify creation_method, to_size, from_size attributes of the feature.
136 void setSize(const ModelHighAPI_Double& theSize);
138 /// Modify creation_method, to_object, to_offset,
139 /// from_object, from_offset attributes of the feature.
141 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
142 const ModelHighAPI_Double& theToOffset,
143 const ModelHighAPI_Selection& theFromObject,
144 const ModelHighAPI_Double& theFromOffset);
146 /// Dump wrapped feature
148 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
151 void execIfBaseNotEmpty();
154 /// Pointer on Extrusion object.
155 typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
157 /// \ingroup CPPHighAPI
158 /// \brief Create Extrusion feature.
160 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
161 const std::list<ModelHighAPI_Selection>& theBaseObjects,
162 const ModelHighAPI_Double& theSize);
164 /// \ingroup CPPHighAPI
165 /// \brief Create Extrusion feature.
167 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
168 const std::list<ModelHighAPI_Selection>& theBaseObjects,
169 const ModelHighAPI_Selection& theDirection,
170 const ModelHighAPI_Double& theSize);
172 /// \ingroup CPPHighAPI
173 /// \brief Create Extrusion feature.
175 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
176 const std::list<ModelHighAPI_Selection>& theBaseObjects,
177 const ModelHighAPI_Double& theToSize,
178 const ModelHighAPI_Double& theFromSize);
180 /// \ingroup CPPHighAPI
181 /// \brief Create Extrusion feature.
183 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
184 const std::list<ModelHighAPI_Selection>& theBaseObjects,
185 const ModelHighAPI_Selection& theDirection,
186 const ModelHighAPI_Double& theToSize,
187 const ModelHighAPI_Double& theFromSize);
189 /// \ingroup CPPHighAPI
190 /// \brief Create Extrusion feature.
192 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
193 const std::list<ModelHighAPI_Selection>& theBaseObjects,
194 const ModelHighAPI_Selection& theToObject,
195 const ModelHighAPI_Double& theToOffset,
196 const ModelHighAPI_Selection& theFromObject,
197 const ModelHighAPI_Double& theFromOffset);
199 /// \ingroup CPPHighAPI
200 /// \brief Create Extrusion feature.
202 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
203 const std::list<ModelHighAPI_Selection>& theBaseObjects,
204 const ModelHighAPI_Selection& theDirection,
205 const ModelHighAPI_Selection& theToObject,
206 const ModelHighAPI_Double& theToOffset,
207 const ModelHighAPI_Selection& theFromObject,
208 const ModelHighAPI_Double& theFromOffset);
210 #endif // FeaturesAPI_Extrusion_H_