- 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));
- }
-
- GeomAlgoAPI_Revolution aFeature(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle);
- if(!aFeature.isDone()) {
- static const std::string aFeatureError = "Revolution algorithm failed";
- setError(aFeatureError);
- break;
- }
-
- // Check if shape is valid
- if(aFeature.shape()->isNull()) {
- static const std::string aShapeError = "Resulting shape is Null";
- setError(aShapeError);
- break;
- }
- if(!aFeature.isValid()) {
- std::string aFeatureError = "Warning: resulting shape is not valid";
- setError(aFeatureError);
- break;
- }
- //LoadNamingDS
- LoadNamingDS(aFeature, aResultBody, aBaseShape, aContext);
-
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
-
- if (aFacesNum == -1)
- break;
- }
- }
- // remove the rest results if there were produced in the previous pass
- removeResults(aResultIndex);
-}
-
-//=================================================================================================
-void FeaturesPlugin_Revolution::LoadNamingDS(GeomAlgoAPI_Revolution& theFeature,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBasis,
- std::shared_ptr<GeomAPI_Shape> theContext)
-{
- if(theBasis->isEqual(theContext))
- theResultBody->store(theFeature.shape());
- else
- theResultBody->storeGenerated(theContext, theFeature.shape());
-
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theFeature.mapOfShapes();
-
- std::string aGeneratedName = "LateralFace";
- theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape().get(), theBasis, EDGE,_LATERAL_TAG, aGeneratedName, *aSubShapes);
-
- //Insert from face
- std::string aBotName = "FromFace";
- std::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
- if(!aBottomFace->isNull()) {
- if(aSubShapes->isBound(aBottomFace)) {
- aBottomFace = aSubShapes->find(aBottomFace);
- }
- theResultBody->generated(aBottomFace, aBotName, _FROM_TAG);
- }
-
- //Insert to face
- std::string aTopName = "ToFace";
- std::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
- if (!aTopFace->isNull()) {
- if (aSubShapes->isBound(aTopFace)) {
- aTopFace = aSubShapes->find(aTopFace);
- }
- theResultBody->generated(aTopFace, aTopName, _TO_TAG);