Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Extrusion.cpp
index 873753a8cf44bca3be2d580c85217b98e77e2478..3056c26826725267bb419994850fb66990db52ff 100644 (file)
@@ -30,11 +30,11 @@ void FeaturesPlugin_Extrusion::initAttributes()
 {
   AttributeSelectionListPtr aSelection = 
     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
-    FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelectionList::type()));
+    FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
   // extrusion works with faces always
   aSelection->setSelectionType("FACE");
-  data()->addAttribute(FeaturesPlugin_Extrusion::SIZE_ID(), ModelAPI_AttributeDouble::type());
-  data()->addAttribute(FeaturesPlugin_Extrusion::REVERSE_ID(), ModelAPI_AttributeBoolean::type());
+  data()->addAttribute(FeaturesPlugin_Extrusion::SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(FeaturesPlugin_Extrusion::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId());
 }
 
 void FeaturesPlugin_Extrusion::execute()
@@ -72,8 +72,12 @@ void FeaturesPlugin_Extrusion::execute()
 
     for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) {
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-      std::shared_ptr<GeomAPI_Shape> aFace = 
-        aFacesNum == -1 ? aValueFace : aConstruction->face(aFaceIndex);
+      std::shared_ptr<GeomAPI_Shape> aFace;
+      if (aFacesNum == -1) {
+        aFace = aValueFace;
+      } else {
+        aFace = std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
+      }
       GeomAlgoAPI_Extrusion aFeature(aFace, aSize);
       if(!aFeature.isDone()) {
         static const std::string aFeatureError = "Extrusion algorithm failed";  
@@ -158,4 +162,4 @@ void FeaturesPlugin_Extrusion::clearResult()
   std::shared_ptr<GeomAPI_Shape> anEmptyShape(new GeomAPI_Shape);
   aResultBody->store(anEmptyShape);
   setResult(aResultBody);
-}
\ No newline at end of file
+}