- // Check if shape is valid
- if(!aPrismAlgo.shape().get() || aPrismAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- aResultIndex = 0;
- break;
- }
- if(!aPrismAlgo.isValid()) {
- std::string aPrismAlgoError = "Error: Resulting shape is not valid.";
- setError(aPrismAlgoError);
- aResultIndex = 0;
- break;
- }
-
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aPrismAlgo, aResultBody, aBaseShape);
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
- }
-
- removeResults(aResultIndex);
-}
-
-//=================================================================================================
-void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBasis)
-{
- //load result
- theResultBody->storeGenerated(theBasis, thePrismAlgo.shape());
-
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = thePrismAlgo.mapOfSubShapes();
-
- //Insert lateral face : Face from Edge
- const std::string aLatName = "LateralFace";
- const int aLatTag = 1;
- theResultBody->loadAndOrientGeneratedShapes(&thePrismAlgo, theBasis, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aSubShapes);
-
- //Insert to faces
- int aToFaceIndex = 1;
- const std::string aToName = "ToFace";
- int aToTag = 2;
- const ListOfShape& aToFaces = thePrismAlgo.toFaces();
- for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
- if(aSubShapes->isBound(aToFace)) {
- aToFace = aSubShapes->find(aToFace);
- }
- std::ostringstream aStr;
- aStr << aToName << "_" << aToFaceIndex++;
- theResultBody->generated(aToFace, aStr.str(), aToTag++);