X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FBuildPlugin%2FBuildPlugin_Shell.cpp;h=d9ed992817e6d6c88c0904611c0686c61e5ac63e;hb=6711a0b2fcad4013b12e1609191c6a0d0db184e8;hp=bd73c2f1fd1ac6ec5486cab5f7032a6d0561ebe4;hpb=9b61e5ee5eafe9d6948d9a78667efa2abec132c3;p=modules%2Fshaper.git diff --git a/src/BuildPlugin/BuildPlugin_Shell.cpp b/src/BuildPlugin/BuildPlugin_Shell.cpp index bd73c2f1f..d9ed99281 100644 --- a/src/BuildPlugin/BuildPlugin_Shell.cpp +++ b/src/BuildPlugin/BuildPlugin_Shell.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "BuildPlugin_Shell.h" @@ -46,14 +45,19 @@ void BuildPlugin_Shell::execute() AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); // Collect base shapes. - ListOfShape aShapes; - for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { + ListOfShape aShapes, aContexts; + getOriginalShapesAndContexts(BASE_OBJECTS_ID(), aShapes, aContexts); + + // Collect sketch faces. + for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); - if(!aShape.get()) { - aShape = aSelection->context()->shape(); + ResultConstructionPtr aContext = + std::dynamic_pointer_cast(aSelection->context()); + if (!aShape && aContext) { + for (int i = 0; i < aContext->facesNum(); ++i) + aShapes.push_back(aContext->face(i)); } - aShapes.push_back(aShape); } // Sew faces. @@ -71,35 +75,7 @@ void BuildPlugin_Shell::execute() int anIndex = 0; for(GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::SHELL); anExp.more(); anExp.next()) { GeomShapePtr aShell = anExp.current(); - ResultBodyPtr aResultBody = document()->createBody(data(), anIndex); - aResultBody->store(aShell); - for(ListOfShape::const_iterator anIt = aShapes.cbegin(); anIt != aShapes.cend(); ++anIt) { - for (GeomAPI_ShapeExplorer aFaceExp(*anIt, GeomAPI_Shape::FACE); - aFaceExp.more(); - aFaceExp.next()) - { - GeomShapePtr aFace = aFaceExp.current(); - ListOfShape aHistory; - aSewingAlgo->modified(aFace, aHistory); - for (ListOfShape::const_iterator aHistoryIt = aHistory.cbegin(); - aHistoryIt != aHistory.cend(); - ++aHistoryIt) - { - GeomShapePtr aHistoryShape = *aHistoryIt; - if (aShell->isSubShape(aHistoryShape, false)) { - aResultBody->loadModifiedShapes(aSewingAlgo, - aFace, - GeomAPI_Shape::EDGE); - aResultBody->loadModifiedShapes(aSewingAlgo, - aFace, - GeomAPI_Shape::FACE); - break; - } - } - } - } - setResult(aResultBody, anIndex); - ++anIndex; + storeResult(aSewingAlgo, aShapes, aContexts, aShell, anIndex++); } removeResults(anIndex);