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 fillAttribute(theBaseObjects, mybaseObjects);
27 setSizes(theSize, ModelHighAPI_Double());
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 fillAttribute(theBaseObjects, mybaseObjects);
40 fillAttribute(theDirection, mydirection);
41 setSizes(theSize, ModelHighAPI_Double());
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 fillAttribute(theBaseObjects, mybaseObjects);
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 fillAttribute(theBaseObjects, mybaseObjects);
68 fillAttribute(theDirection, mydirection);
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 fillAttribute(theBaseObjects, mybaseObjects);
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 fillAttribute(theBaseObjects, mybaseObjects);
100 fillAttribute(theDirection, mydirection);
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(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
132 fillAttribute(theToSize, mytoSize);
133 fillAttribute(theFromSize, myfromSize);
138 //==================================================================================================
139 void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double& theSize)
141 fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), 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(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
155 fillAttribute(theToObject, mytoObject);
156 fillAttribute(theToOffset, mytoOffset);
157 fillAttribute(theFromObject, myfromObject);
158 fillAttribute(theFromOffset, myfromOffset);
163 //==================================================================================================
164 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
165 const std::list<ModelHighAPI_Selection>& theBaseObjects,
166 const ModelHighAPI_Double& theSize)
168 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
169 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize));
172 //==================================================================================================
173 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
174 const std::list<ModelHighAPI_Selection>& theBaseObjects,
175 const ModelHighAPI_Selection& theDirection,
176 const ModelHighAPI_Double& theSize)
178 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
179 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theDirection, theSize));
182 //==================================================================================================
183 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
184 const std::list<ModelHighAPI_Selection>& theBaseObjects,
185 const ModelHighAPI_Double& theToSize,
186 const ModelHighAPI_Double& theFromSize)
188 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
189 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theToSize, theFromSize));
192 //==================================================================================================
193 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
194 const std::list<ModelHighAPI_Selection>& theBaseObjects,
195 const ModelHighAPI_Selection& theDirection,
196 const ModelHighAPI_Double& theToSize,
197 const ModelHighAPI_Double& theFromSize)
199 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
200 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
207 //==================================================================================================
208 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
209 const std::list<ModelHighAPI_Selection>& theBaseObjects,
210 const ModelHighAPI_Selection& theToObject,
211 const ModelHighAPI_Double& theToOffset,
212 const ModelHighAPI_Selection& theFromObject,
213 const ModelHighAPI_Double& theFromOffset)
215 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
216 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
224 //==================================================================================================
225 ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
226 const std::list<ModelHighAPI_Selection>& theBaseObjects,
227 const ModelHighAPI_Selection& theDirection,
228 const ModelHighAPI_Selection& theToObject,
229 const ModelHighAPI_Double& theToOffset,
230 const ModelHighAPI_Selection& theFromObject,
231 const ModelHighAPI_Double& theFromOffset)
233 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
234 return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,