Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Extrusion.cpp
index b232f18e7bd732b7f9d0fa8307654beb1b12e3c6..295fb1c9de489e55cd14f0df7190b7c341e05625 100644 (file)
@@ -3,7 +3,7 @@
 // Author:      Vitaly SMETANNIKOV
 
 #include "FeaturesPlugin_Extrusion.h"
-#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_ResultConstruction.h>
@@ -29,16 +29,24 @@ void FeaturesPlugin_Extrusion::initAttributes()
 
 void FeaturesPlugin_Extrusion::execute()
 {
-  boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
+  boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeReference>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
   if (!aFaceRef)
     return;
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr =
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFaceRef->value());
-  if (!aConstr) 
-    return;
-  boost::shared_ptr<GeomAPI_Shape> aFace = aConstr->shape();
-  if (!aFace)
+  boost::shared_ptr<GeomAPI_Shape> aFace;
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(aFaceRef->value());
+  if (aConstr) {
+    aFace = aConstr->shape();
+  }
+  if (!aFace) {
+    // Check for body
+    boost::shared_ptr<ModelAPI_ResultBody> aBody = boost::dynamic_pointer_cast<
+        ModelAPI_ResultBody>(aFaceRef->value());
+    if (aBody) 
+      aFace = aBody->shape();
+  }
+  if (!aFace) 
     return;
 
   double aSize = data()->real(FeaturesPlugin_Extrusion::SIZE_ID())->value();