1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Extrusion.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_Extrusion.h"
9 #include <ModelHighAPI_Double.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const std::list<ModelHighAPI_Selection>& theBaseObjects,
22 const ModelHighAPI_Double& theSize)
23 : ModelHighAPI_Interface(theFeature)
26 setBase(theBaseObjects);
31 //==================================================================================================
32 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
33 const std::list<ModelHighAPI_Selection>& theBaseObjects,
34 const ModelHighAPI_Selection& theDirection,
35 const ModelHighAPI_Double& theSize)
36 : ModelHighAPI_Interface(theFeature)
39 setBase(theBaseObjects);
40 setDirection(theDirection);
45 //==================================================================================================
46 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47 const std::list<ModelHighAPI_Selection>& theBaseObjects,
48 const ModelHighAPI_Double& theToSize,
49 const ModelHighAPI_Double& theFromSize)
50 : ModelHighAPI_Interface(theFeature)
53 setBase(theBaseObjects);
54 setSizes(theToSize, theFromSize);
58 //==================================================================================================
59 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
60 const std::list<ModelHighAPI_Selection>& theBaseObjects,
61 const ModelHighAPI_Selection& theDirection,
62 const ModelHighAPI_Double& theToSize,
63 const ModelHighAPI_Double& theFromSize)
64 : ModelHighAPI_Interface(theFeature)
67 setBase(theBaseObjects);
68 setDirection(theDirection);
69 setSizes(theToSize, theFromSize);
73 //==================================================================================================
74 FeaturesAPI_Extrusion::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 : ModelHighAPI_Interface(theFeature)
83 setBase(theBaseObjects);
84 setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
88 //==================================================================================================
89 FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
90 const std::list<ModelHighAPI_Selection>& theBaseObjects,
91 const ModelHighAPI_Selection& theDirection,
92 const ModelHighAPI_Selection& theToObject,
93 const ModelHighAPI_Double& theToOffset,
94 const ModelHighAPI_Selection& theFromObject,
95 const ModelHighAPI_Double& theFromOffset)
96 : ModelHighAPI_Interface(theFeature)
99 setBase(theBaseObjects);
100 setDirection(theDirection);
101 setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
105 //==================================================================================================
106 FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion()
111 //==================================================================================================
112 void FeaturesAPI_Extrusion::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
114 fillAttribute(theBaseObjects, mybaseObjects);
119 //==================================================================================================
120 void FeaturesAPI_Extrusion::setDirection(const ModelHighAPI_Selection& theDirection)
122 fillAttribute(theDirection, mydirection);
127 //==================================================================================================
128 void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double& theToSize,
129 const ModelHighAPI_Double& theFromSize)
131 fillAttribute("BySizes", mycreationMethod);
132 fillAttribute(theToSize, mytoSize);
133 fillAttribute(theFromSize, myfromSize);
138 //==================================================================================================
139 void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double& theSize)
141 fillAttribute("BySizes", mycreationMethod);
142 fillAttribute(theSize, mytoSize);
143 fillAttribute(ModelHighAPI_Double(), myfromSize);
148 //==================================================================================================
149 void FeaturesAPI_Extrusion::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
150 const ModelHighAPI_Double& theToOffset,
151 const ModelHighAPI_Selection& theFromObject,
152 const ModelHighAPI_Double& theFromOffset)
154 fillAttribute("ByPlanesAndOffsets", mycreationMethod);
155 fillAttribute(theToObject, mytoObject);
156 fillAttribute(theToOffset, mytoOffset);
157 fillAttribute(theFromObject, myfromObject);
158 fillAttribute(theFromOffset, myfromOffset);
163 // TODO(spo): make add* as static functions of the class
164 //==================================================================================================
165 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
166 const std::list<ModelHighAPI_Selection>& theBaseObjects,
167 const ModelHighAPI_Double& theSize)
169 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
170 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize));
173 //==================================================================================================
174 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
175 const std::list<ModelHighAPI_Selection>& theBaseObjects,
176 const ModelHighAPI_Selection& theDirection,
177 const ModelHighAPI_Double& theSize)
179 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
180 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theDirection, theSize));
183 //==================================================================================================
184 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
185 const std::list<ModelHighAPI_Selection>& theBaseObjects,
186 const ModelHighAPI_Double& theToSize,
187 const ModelHighAPI_Double& theFromSize)
189 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
190 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theToSize, theFromSize));
193 //==================================================================================================
194 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
195 const std::list<ModelHighAPI_Selection>& theBaseObjects,
196 const ModelHighAPI_Selection& theDirection,
197 const ModelHighAPI_Double& theToSize,
198 const ModelHighAPI_Double& theFromSize)
200 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
201 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
208 //==================================================================================================
209 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
210 const std::list<ModelHighAPI_Selection>& theBaseObjects,
211 const ModelHighAPI_Selection& theToObject,
212 const ModelHighAPI_Double& theToOffset,
213 const ModelHighAPI_Selection& theFromObject,
214 const ModelHighAPI_Double& theFromOffset)
216 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
217 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
225 //==================================================================================================
226 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
227 const std::list<ModelHighAPI_Selection>& theBaseObjects,
228 const ModelHighAPI_Selection& theDirection,
229 const ModelHighAPI_Selection& theToObject,
230 const ModelHighAPI_Double& theToOffset,
231 const ModelHighAPI_Selection& theFromObject,
232 const ModelHighAPI_Double& theFromOffset)
234 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
235 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,