- AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Extrusion::LIST_ID());
-
- // Getting bounding planes.
- std::shared_ptr<GeomAPI_Shape> aFromShape;
- std::shared_ptr<GeomAPI_Shape> aToShape;
-
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
- if (anObjRef) {
- aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
- }
- anObjRef = selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID());
- if (anObjRef) {
- aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
- }
-
- // Getting sizes.
- double aFromSize = real(FeaturesPlugin_Extrusion::FROM_SIZE_ID())->value();
- double aToSize = real(FeaturesPlugin_Extrusion::TO_SIZE_ID())->value();
-
- // for each selected face generate a result
- int anIndex = 0, aResultIndex = 0;
- for(; anIndex < aFaceRefs->size(); anIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aFaceRef = aFaceRefs->value(anIndex);
- ResultPtr aContextRes = aFaceRef->context();
- std::shared_ptr<GeomAPI_Shape> aContext = aContextRes->shape();
- if (!aContext.get()) {
- static const std::string aContextError = "The selection context is bad";
- setError(aContextError);
- break;
- }
-
- std::shared_ptr<GeomAPI_Shape> aValueFace = aFaceRef->value();
- int aFacesNum = -1; // this mean that "aFace" is used
- ResultConstructionPtr aConstruction =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContextRes);
- if (!aValueFace.get()) { // this may be the whole sketch result selected, check and get faces
- if (aConstruction.get()) {
- aFacesNum = aConstruction->facesNum();
- } else {
+ // Getting faces.
+ ListOfShape aFacesList;
+ AttributeSelectionListPtr aFacesSelectionList = selectionList(LIST_ID());
+ for(int anIndex = 0; anIndex < aFacesSelectionList->size(); anIndex++) {
+ AttributeSelectionPtr aFaceSel = aFacesSelectionList->value(anIndex);
+ std::shared_ptr<GeomAPI_Shape> aFaceShape = aFaceSel->value();
+ if(aFaceShape.get() && !aFaceShape->isNull()) { // Getting face.
+ aFacesList.push_back(aFaceShape);
+ } else { // This may be the whole sketch result selected, check and get faces.
+ ResultPtr aContext = aFaceSel->context();
+ std::shared_ptr<GeomAPI_Shape> aContextShape = aContext->shape();
+ if(!aContextShape.get()) {
+ static const std::string aContextError = "The selection context is bad";
+ setError(aContextError);
+ return;
+ }
+ ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
+ if(!aConstruction.get()) {