- //load result
- if(theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape);
- } else {
- const int aGenTag = 1;
- const int aModTag = 2;
- const int aDelTag = 3;
- const int aSubsolidsTag=4; /// sub solids will be placed at labels 6, 7, etc. if result is compound of solids
- int aToTag = 5; // may be many labels, starting from this index
- int aFromTag = 10000; // may be many labels, starting from this index or last aToTag index
- const std::string aGenName = "Generated";
- const std::string aModName = "Modified";
- const std::string aLatName = "LateralFace";
- const std::string aFromName = "FromFace";
- const std::string aToName = "ToFace";
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
- ListOfShape::const_iterator aShellsIter = theShells.begin();
- std::list<std::shared_ptr<GeomAPI_Interface>>::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
- for(; aShellsIter != theShells.end() && aSolidsAlgosIter != theSolidsAlgos.end(); aShellsIter++, aSolidsAlgosIter++) {
- ListOfShape aFromFaces;
- ListOfShape aToFaces;
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes;
-
- //Insert lateral face : Face from Edge
- if(std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter)) {
- std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter);
- aSubShapes = aPrismAlgo->mapOfSubShapes();
- theResultBody->loadAndOrientGeneratedShapes(aPrismAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
- aLatName, *aSubShapes.get());
-
- aFromFaces = aPrismAlgo->fromFaces();
- aToFaces = aPrismAlgo->toFaces();
- } else if(std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter)) {
- std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter);
- aSubShapes = aRevolAlgo->mapOfShapes();
- theResultBody->loadAndOrientGeneratedShapes(aRevolAlgo->makeShape().get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
- aLatName, *aSubShapes.get());
- aFromFaces = aRevolAlgo->fromFaces();
- aToFaces = aRevolAlgo->toFaces();
- }
-
- //Insert to faces
- 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);
- }
- theResultBody->generated(aToFace, aToName, aToTag++);
- }
-
- //Insert from faces
- if (aFromTag < aToTag) aFromTag = aToTag;
- for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
- if(aSubShapes->isBound(aFromFace)) {
- aFromFace = aSubShapes->find(aFromFace);
- }
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
- }
- }
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModTag, aModName, theMapOfShapes);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDelTag);