- //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 = 5000; // 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();
- ListOfMakeShape::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
- for(; aShellsIter != theShells.end() && aSolidsAlgosIter != theSolidsAlgos.end(); aShellsIter++, aSolidsAlgosIter++) {
- //Insert lateral face : Face from Edge
- std::shared_ptr<GeomAlgoAPI_MakeShape> aSolidAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeShape>(*aSolidsAlgosIter);
- if(aSolidAlgo.get()) {
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aSolidAlgo->mapOfSubShapes();
- theResultBody->loadAndOrientGeneratedShapes(aSolidAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
- aLatName, *aSubShapes.get());
-
-
- std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(aSolidAlgo);
- if(aSweepAlgo.get()) {
- //Insert to faces
- int aToFaceIndex = 1;
- const ListOfShape& aToFaces = aSweepAlgo->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++);
- }
-
- //Insert from faces
- int aFromFaceIndex = 1;
- const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
- 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);
- }
- std::ostringstream aStr;
- aStr << aFromName << "_" << aFromFaceIndex++;
- theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
- }
- }
- }
- }
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModTag, aModName, theMapOfShapes);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDelTag);