X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_CompositeSketch.cpp;h=3f95c49e857afc88cbc4d517705847699e4b2939;hb=4fc2dc9fdc0c14fab5f2780598eccdc1368d81b9;hp=d9ff9ccfce5966c2e27f3d39656674cc71450b70;hpb=cbde248859fb0072f6012907391ea90cfc254574;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index d9ff9ccfc..3f95c49e8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -140,20 +140,17 @@ void FeaturesPlugin_CompositeSketch::execute() int aErrorsNum = 0; int aResultIndex = 0; for(ListOfShape::const_iterator anIter = aShells.cbegin(); anIter != aShells.cend(); anIter++) { - std::shared_ptr aResult; - ListOfShape aFromFaces, aToFaces; std::shared_ptr aMakeShape; - std::shared_ptr aDataMap; std::shared_ptr aBaseFace = *anIter; - makeSolid(aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap); - if(!aResult.get()) { + makeSolid(aBaseFace, aMakeShape); + if(!aMakeShape.get()) { aErrorsNum++; continue; } ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - loadNamingDS(aResultBody, aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap); + loadNamingDS(aResultBody, aBaseFace, aMakeShape); setResult(aResultBody, aResultIndex); aResultIndex++; } @@ -171,39 +168,41 @@ void FeaturesPlugin_CompositeSketch::execute() //================================================================================================= void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr& theBaseShape, - const std::shared_ptr& theResult, - const ListOfShape& theFromFaces, - const ListOfShape& theToFaces, - const std::shared_ptr& theMakeShape, - const std::shared_ptr& theDataMap) + const std::shared_ptr& theMakeShape) { //load result - theResultBody->storeGenerated(theBaseShape, theResult); + theResultBody->storeGenerated(theBaseShape, theMakeShape->shape()); //Insert lateral face : Face from Edge const std::string aLatName = "LateralFace"; const int aLatTag = 1; - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *theDataMap); - - //Insert to faces - const std::string aToName = "ToFace"; - int aToTag = 2; - for(ListOfShape::const_iterator anIt = theToFaces.cbegin(); anIt != theToFaces.cend(); anIt++) { - std::shared_ptr aToFace = *anIt; - if(theDataMap->isBound(aToFace)) { - aToFace = theDataMap->find(aToFace); + std::shared_ptr aDataMap = theMakeShape->mapOfSubShapes(); + theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aDataMap.get()); + + std::shared_ptr aSweepAlgo = std::dynamic_pointer_cast(theMakeShape); + if(aSweepAlgo.get()) { + //Insert to faces + const std::string aToName = "ToFace"; + int aToTag = 2; + const ListOfShape& aToFaces = aSweepAlgo->toFaces(); + for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) { + std::shared_ptr aToFace = *anIt; + if(aDataMap->isBound(aToFace)) { + aToFace = aDataMap->find(aToFace); + } + theResultBody->generated(aToFace, aToName, aToTag++); } - theResultBody->generated(aToFace, aToName, aToTag++); - } - //Insert from faces - const std::string aFromName = "FromFace"; - int aFromTag = aToTag > 10000 ? aToTag : 10000; - for(ListOfShape::const_iterator anIt = theFromFaces.cbegin(); anIt != theFromFaces.cend(); anIt++) { - std::shared_ptr aFromFace = *anIt; - if(theDataMap->isBound(aFromFace)) { - aFromFace = theDataMap->find(aFromFace); + //Insert from faces + const std::string aFromName = "FromFace"; + int aFromTag = aToTag > 10000 ? aToTag : 10000; + const ListOfShape& aFromFaces = aSweepAlgo->fromFaces(); + for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) { + std::shared_ptr aFromFace = *anIt; + if(aDataMap->isBound(aFromFace)) { + aFromFace = aDataMap->find(aFromFace); + } + theResultBody->generated(aFromFace, aFromName, aFromTag++); } - theResultBody->generated(aFromFace, aFromName, aFromTag++); } }