+
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
+ GeomAlgoAPI_Extrusion aFeature(aFace, aSize);
+ if(!aFeature.isDone()) {
+ static const std::string aFeatureError = "Extrusion algorithm failed";
+ setError(aFeatureError);
+ return;
+ }
+
+ // Check if shape is valid
+ if (aFeature.shape()->isNull()) {
+ static const std::string aShapeError = "Resulting shape is Null";
+ setError(aShapeError);
+ return;
+ }
+ if(!aFeature.isValid()) {
+ std::string aFeatureError = "Warning: resulting shape is not valid";
+ setError(aFeatureError);
+ return;
+ }
+ //LoadNamingDS
+ LoadNamingDS(aFeature, aResultBody, aFace, aContext);
+
+ setResult(aResultBody);
+}
+
+//============================================================================
+void FeaturesPlugin_Extrusion::LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theBasis,
+ std::shared_ptr<GeomAPI_Shape> theContext)
+{
+
+
+ //load result
+ if(theBasis->isEqual(theContext))
+ theResultBody->store(theFeature.shape());
+ else
+ theResultBody->storeGenerated(theContext, theFeature.shape());
+
+ GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape();
+ theFeature.mapOfShapes(*aSubShapes);
+
+ //Insert lateral face : Face from Edge
+ std::string aLatName = "LateralFace";
+ theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, aLatName, *aSubShapes);
+
+ //Insert bottom face
+ std::string aBotName = "BottomFace";
+ std::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
+ if (!aBottomFace->isNull()) {
+ if (aSubShapes->isBound(aBottomFace)) {
+ aBottomFace = aSubShapes->find(aBottomFace);
+ }
+ theResultBody->generated(aBottomFace, aBotName, _FIRST_TAG);
+ }
+
+
+
+ //Insert top face
+ std::string aTopName = "TopFace";
+ std::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
+ if (!aTopFace->isNull()) {
+ if (aSubShapes->isBound(aTopFace)) {
+ aTopFace = aSubShapes->find(aTopFace);
+ }
+ theResultBody->generated(aTopFace, aTopName, _LAST_TAG);
+ }
+