- for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) {
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- std::shared_ptr<GeomAPI_Shape> aBaseShape;
- if (aFacesNum == -1) {
- aBaseShape = aValueFace;
- } else {
- aBaseShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
- }
-
- // If bounding faces was not set creating them.
- std::shared_ptr<GeomAPI_Face> aBaseFace(new GeomAPI_Face(aBaseShape));
- std::shared_ptr<GeomAPI_Pln> aBasePlane = aBaseFace->getPlane();
- std::shared_ptr<GeomAPI_Dir> aBaseDir = aBasePlane->direction();
- std::shared_ptr<GeomAPI_Pnt> aBaseLoc = aBasePlane->location();
-
- if(!aFromShape) {
- aFromShape = GeomAlgoAPI_FaceBuilder::plane(aBaseLoc, aBaseDir);
- }
- if(!aToShape) {
- aToShape = GeomAlgoAPI_FaceBuilder::plane(aBaseLoc, aBaseDir);
- }
-
- // Moving bounding faces according to "from" and "to" sizes.
- std::shared_ptr<GeomAPI_Face> aFromFace(new GeomAPI_Face(aFromShape));
- std::shared_ptr<GeomAPI_Pln> aFromPlane = aFromFace->getPlane();
- std::shared_ptr<GeomAPI_Pnt> aFromLoc = aFromPlane->location();
- std::shared_ptr<GeomAPI_Dir> aFromDir = aFromPlane->direction();
-
- std::shared_ptr<GeomAPI_Face> aToFace(new GeomAPI_Face(aToShape));
- std::shared_ptr<GeomAPI_Pln> aToPlane = aToFace->getPlane();
- std::shared_ptr<GeomAPI_Pnt> aToLoc = aToPlane->location();
- std::shared_ptr<GeomAPI_Dir> aToDir = aToPlane->direction();
-
- bool aSign = aFromLoc->xyz()->dot(aBaseDir->xyz()) > aToLoc->xyz()->dot(aBaseDir->xyz());
-
- std::shared_ptr<GeomAPI_Pnt> aFromPnt(new GeomAPI_Pnt(aFromLoc->xyz()->added(aBaseDir->xyz()->multiplied(aSign ? aFromSize : -aFromSize))));
- aFromShape = GeomAlgoAPI_FaceBuilder::plane(aFromPnt, aFromDir);
-
- std::shared_ptr<GeomAPI_Pnt> aToPnt(new GeomAPI_Pnt(aToLoc->xyz()->added(aBaseDir->xyz()->multiplied(aSign ? -aToSize : aToSize))));
- aToShape = GeomAlgoAPI_FaceBuilder::plane(aToPnt, aToDir);
-
- //GeomAlgoAPI_Extrusion aFeature(aFace, aFromSize);
- GeomAlgoAPI_Prism aFeature(aBaseShape, aFromShape, aToShape);
- if(!aFeature.isDone()) {
- static const std::string aFeatureError = "Extrusion algorithm failed";
- setError(aFeatureError);
- break;
- }
+ // Getting sizes.
+ double aToSize = 0.0;
+ double aFromSize = 0.0;
+
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_SIZES()) {
+ aToSize = real(TO_SIZE_ID())->value();
+ aFromSize = real(FROM_SIZE_ID())->value();
+ } else {
+ aToSize = real(TO_OFFSET_ID())->value();
+ aFromSize = real(FROM_OFFSET_ID())->value();
+ }