]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge remote-tracking branch 'remotes/origin/HigherLevelObjectsHistory'
authorazv <azv@opencascade.com>
Tue, 26 Feb 2019 12:38:17 +0000 (15:38 +0300)
committerazv <azv@opencascade.com>
Tue, 26 Feb 2019 12:38:17 +0000 (15:38 +0300)
# Conflicts:
# env.sh
# src/FeaturesPlugin/CMakeLists.txt
# src/SketchPlugin/Test/TestUpdateSketch.py

65 files changed:
1  2 
doc/gui/conf.py.in
src/BuildPlugin/BuildPlugin_CompSolid.cpp
src/BuildPlugin/BuildPlugin_CompSolid.h
src/BuildPlugin/BuildPlugin_Compound.cpp
src/BuildPlugin/BuildPlugin_Edge.cpp
src/BuildPlugin/BuildPlugin_Face.cpp
src/BuildPlugin/BuildPlugin_Face.h
src/BuildPlugin/BuildPlugin_Shell.cpp
src/BuildPlugin/BuildPlugin_Shell.h
src/BuildPlugin/BuildPlugin_Solid.cpp
src/BuildPlugin/BuildPlugin_Solid.h
src/BuildPlugin/BuildPlugin_Validators.cpp
src/BuildPlugin/CMakeLists.txt
src/CollectionPlugin/CMakeLists.txt
src/CollectionPlugin/Test/TestGroupMove01.py
src/CollectionPlugin/Test/TestGroupMove02.py
src/CollectionPlugin/Test/TestGroupMove03.py
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp
src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp
src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp
src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp
src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h
src/FeaturesPlugin/FeaturesPlugin_Partition.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Scale.cpp
src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
src/FeaturesPlugin/FeaturesPlugin_Tools.cpp
src/FeaturesPlugin/FeaturesPlugin_Tools.h
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp
src/FeaturesPlugin/Test/Test1942.py
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h
src/GeomAlgoAPI/GeomAlgoAPI.i
src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h
src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp
src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h
src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/Model/Model_AttributeString.h
src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultBody.h
src/Model/Model_ResultConstruction.cpp
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/Test/Test2358_2.py
src/SketchPlugin/Test/TestMovementComplex.py

diff --combined doc/gui/conf.py.in
index ed3e6fd5b6636b7c7a27bccaf935020c80c5d11e,fc9b77f6cea818fb2926fca3874b214c7adef699..b02b59b3f3e5686d86b1aa25dad80846082246ff
@@@ -51,7 -51,7 +51,7 @@@ master_doc = 'index
  
  # General information about the project.
  project = u'SHAPER'
 -copyright = u'2014-2017  CEA/DEN, EDF R&D'
 +copyright = u'2014-2019  CEA/DEN, EDF R&D'
  
  # Copyright is shown via custom footer
  html_show_copyright = False
@@@ -61,9 -61,9 +61,9 @@@
  # built documents.
  #
  # The short X.Y version.
- version = u'3.0.0'
+ version = u'9.2.0'
  # The full version, including alpha/beta/rc tags.
- release = u'3.0.0'
+ release = u'9.2.0'
  
  # The language for content autogenerated by Sphinx. Refer to documentation
  # for a list of supported languages.
index 9034b1a7eafd5181ffdbcda09ef9671db188c998,7b94fff13e1732bf4a09552942249e2111ef37f9..c45eeb23eb3f4e396f98154ea26d8d8775e27daf
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017-20xx  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_CompSolid.h"
@@@ -32,25 -33,3 +32,3 @@@ void BuildPlugin_CompSolid::initAttribu
  {
    data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
  }
- //=================================================================================================
- void BuildPlugin_CompSolid::execute()
- {
-   // all the needed checkings are in validator, so, here just make and store result
-   ListOfShape anOriginalShapes;
-   AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
-   for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
-     AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
-     GeomShapePtr aShape = aSelection->value();
-     if (!aShape.get())
-       aShape = aSelection->context()->shape();
-     anOriginalShapes.push_back(aShape);
-   }
-   std::shared_ptr<GeomAlgoAPI_MakeVolume> anAlgo(
-     new GeomAlgoAPI_MakeVolume(anOriginalShapes, false));
-   GeomShapePtr aVolumeRes = anAlgo->shape();
-   // check and process result of volume maker
-   GeomShapePtr aResShape = getSingleSubshape(aVolumeRes);
-   storeResult(anOriginalShapes, aResShape, anAlgo);
- }
index 335d6f8ebdc79b686818fe45d63418d593d09977,ae99a1eda7c5f0534a0e8a4f711efff568147cb9..bf6b9c5dc742e32a93db5bfc65bd8c36532d289e
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017-20xx  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef BuildPlugin_CompSolid_H_
@@@ -55,9 -56,6 +55,6 @@@ public
  
    /// Request for initialization of data model of the feature: adding all attributes.
    BUILDPLUGIN_EXPORT virtual void initAttributes();
-   /// Creates a new part document if needed.
-   BUILDPLUGIN_EXPORT virtual void execute();
  };
  
  #endif
index c2c6f756c1729bebd9cbd70fdda211c2e6e6bc75,68997c9880a95d84ca4cb0cc281cc3a5d3985423..7aa9a81641d78c6c47d0f58ae41f17c78968e6d5
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017-20xx  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Compound.h"
@@@ -75,7 -76,7 +75,7 @@@ void BuildPlugin_Compound::execute(
    int anIndexToRemove = 0;
    if (aCopyCompound) {
      ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++);
-     aResultBody->store(aCopyCompound);
+     aResultBody->storeModified(anOriginalShapes, aCopyCompound, aCopyAlgo);
      aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX);
      aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::EDGE);
      aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::FACE);
index 30460c159e937b65f3fd53d2b939f78bd0cf7e55,ee1339f520134873a668b2a6016612530dcc4a4f..c7928d083dcad5eb5bb818763d8baaf65148a8f2
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Edge.h"
@@@ -86,7 -87,10 +86,10 @@@ void BuildPlugin_Edge::execute(
  
      // Store result.
      ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-     aResultBody->storeModified(aShape, aCopyAlgo->shape());
+     ListOfShape aBaseShapes;
+     aBaseShapes.push_back(aShape);
+     aResultBody->storeModified(aBaseShapes, aCopyAlgo->shape(), aCopyAlgo);
      aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
  
      setResult(aResultBody, aResultIndex);
index e4f43c6013fb731d36b0a8f8596a0bca3abf29c3,1749c3b31ca9de2a4e5ed56ebbd594150ea91b05..022865abdd3682773a3b4a0a1cee2e70858ea434
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Face.h"
@@@ -27,6 -28,7 +27,7 @@@
  #include <GeomAPI_Pln.h>
  #include <GeomAPI_ShapeExplorer.h>
  
+ #include <GeomAlgoAPI_MakeShapeList.h>
  #include <GeomAlgoAPI_ShapeTools.h>
  #include <GeomAlgoAPI_SketchBuilder.h>
  #include <GeomAlgoAPI_Copy.h>
@@@ -59,6 -61,9 +60,9 @@@ void BuildPlugin_Face::execute(
    // Collect base shapes.
    ListOfShape anEdges;
    ListOfShape anOriginalFaces;
+   ListOfShape aContexts;
+   getOriginalShapesAndContexts(BASE_OBJECTS_ID(), anOriginalFaces, aContexts);
+   anOriginalFaces.clear();
    std::list< std::shared_ptr<GeomAPI_Dir> > aListOfNormals;
    for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
      AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
  
    // Build faces by edges.
    ListOfShape aFaces;
+   GeomMakeShapePtr aFaceBuilder;
    if (!anEdges.empty())
-     buildFacesByEdges(anEdges, aListOfNormals, aFaces);
+     buildFacesByEdges(anEdges, aListOfNormals, aFaces, aFaceBuilder);
+   int aNbFacesFromEdges = (int)aFaces.size();
  
    // Add faces selected by user.
    aFaces.insert(aFaces.end(), anOriginalFaces.begin(), anOriginalFaces.end());
    // Store result.
    int anIndex = 0;
    for(ListOfShape::const_iterator anIt = aFaces.cbegin(); anIt != aFaces.cend(); ++anIt) {
-     ResultBodyPtr aResultBody = document()->createBody(data(), anIndex);
-     GeomShapePtr aShape = *anIt;
-     GeomAlgoAPI_Copy aCopy(aShape);
-     aShape = aCopy.shape();
-     aResultBody->store(aShape);
-     // Store edges.
-     int anEdgeIndex = 1;
-     for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
-       GeomShapePtr anEdge = anExp.current();
-       aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex));
-       ++anEdgeIndex;
-     }
+     std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList);
+     if (anIndex < aNbFacesFromEdges)
+       aMakeShapeList->appendAlgo(aFaceBuilder);
  
-     setResult(aResultBody, anIndex);
-     ++anIndex;
+     GeomShapePtr aShape = *anIt;
+     GeomMakeShapePtr aCopy(new GeomAlgoAPI_Copy(aShape));
+     aMakeShapeList->appendAlgo(aCopy);
+     ListOfShape aBaseShapes;
+     if (anIndex < aNbFacesFromEdges)
+       aBaseShapes = anEdges;
+     else
+       aBaseShapes.push_back(aShape);
+     storeResult(aMakeShapeList, aBaseShapes, aContexts, aCopy->shape(), anIndex++);
    }
  
    removeResults(anIndex);
  void BuildPlugin_Face::buildFacesByEdges(
      const ListOfShape& theEdges,
      const std::list< std::shared_ptr<GeomAPI_Dir> >& theNormals,
-     ListOfShape& theFaces) const
+     ListOfShape& theFaces,
+     std::shared_ptr<GeomAlgoAPI_MakeShape>& theBuilderAlgo) const
  {
    // Get plane.
    std::shared_ptr<GeomAPI_Pln> aPln = GeomAlgoAPI_ShapeTools::findPlane(theEdges);
    }
  
    // Get faces.
-   GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
-                                          aPln->direction(), theEdges, theFaces);
+   std::shared_ptr<GeomAlgoAPI_SketchBuilder> aSketchBuilder(
+       new GeomAlgoAPI_SketchBuilder(aPln, theEdges));
+   theFaces = aSketchBuilder->faces();
+   theBuilderAlgo = aSketchBuilder;
  
    // Get wires from faces.
    ListOfShape aWires;
index 90cc1933350af57a58b91987c2450f5dcd7723a8,ad5fd4a9781965af40ba6c332b32d18d0a599ad3..1545de1a9b936e0834c99ee303f70ded4edd14f1
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef BuildPlugin_Face_H_
  #define BuildPlugin_Face_H_
  
  #include "BuildPlugin.h"
- #include <ModelAPI_Feature.h>
+ #include "BuildPlugin_Shape.h"
  
  class GeomAPI_Dir;
  class GeomAPI_Shape;
+ class GeomAlgoAPI_MakeShape;
  
  /// \class BuildPlugin_Face
  /// \ingroup Plugins
  /// \brief Feature for creation of face from sketch edges or existing wires.
- class BuildPlugin_Face: public ModelAPI_Feature
+ class BuildPlugin_Face: public BuildPlugin_Shape
  {
  public:
    /// Use plugin manager for features creation
@@@ -67,7 -68,8 +67,8 @@@ private
    /// Create faces basing on the list of edges
    void buildFacesByEdges(const std::list< std::shared_ptr<GeomAPI_Shape> >& theEdges,
                           const std::list< std::shared_ptr<GeomAPI_Dir> >& theNormals,
-                          std::list< std::shared_ptr<GeomAPI_Shape> >& theFaces) const;
+                          std::list< std::shared_ptr<GeomAPI_Shape> >& theFaces,
+                          std::shared_ptr<GeomAlgoAPI_MakeShape>& theBuilderAlgo) const;
  };
  
  #endif
index ed71dcb0cc7aa443453628c2398466113a26c842,4e27b66c29ac88016c93e6378efdca3f0d0429ed..7f1010307502ee73fa57b18556aa824de3880354
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Shell.h"
@@@ -45,15 -46,8 +45,8 @@@ void BuildPlugin_Shell::execute(
    AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
  
    // Collect base shapes.
-   ListOfShape aShapes;
-   for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
-     AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
-     GeomShapePtr aShape = aSelection->value();
-     if(!aShape.get()) {
-       aShape = aSelection->context()->shape();
-     }
-     aShapes.push_back(aShape);
-   }
+   ListOfShape aShapes, aContexts;
+   getOriginalShapesAndContexts(BASE_OBJECTS_ID(), aShapes, aContexts);
  
    // Sew faces.
    GeomMakeShapePtr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes));
    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);
index a89b5fbf04f6840ca931a9a0cd014ec982c0a0cc,3b7245482f33fda15c63f83f8ad373b466acfcaa..514aa349e54b988769bf2ebecfd675d534d83067
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef BuildPlugin_Shell_H_
  #define BuildPlugin_Shell_H_
  
  #include "BuildPlugin.h"
- #include <ModelAPI_Feature.h>
+ #include "BuildPlugin_Shape.h"
  
  /// \class BuildPlugin_Shell
  /// \ingroup Plugins
  /// \brief Feature for creation of shell from faces and shells.
- class BuildPlugin_Shell: public ModelAPI_Feature
+ class BuildPlugin_Shell: public BuildPlugin_Shape
  {
  public:
    /// Use plugin manager for features creation
index 00d9a473a6af37608f39c4a26f0b18ee0121d321,399289537ac2d541c4141fc2e00e4aa4545a2c21..215be1683a9f934717560d3b5f1f7324a84481ba
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017-20xx  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Solid.h"
@@@ -22,6 -23,7 +22,7 @@@
  #include <ModelAPI_AttributeSelectionList.h>
  #include <ModelAPI_ResultBody.h>
  
+ #include <GeomAPI_ShapeExplorer.h>
  #include <GeomAPI_ShapeIterator.h>
  
  #include <GeomAlgoAPI_MakeVolume.h>
@@@ -41,38 -43,15 +42,15 @@@ void BuildPlugin_Solid::initAttributes(
  void BuildPlugin_Solid::execute()
  {
    // all the needed checkings are in validator, so, here just make and store result
-   ListOfShape anOriginalShapes;
-   AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
-   for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
-     AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
-     GeomShapePtr aShape = aSelection->value();
-     if (!aShape.get())
-       aShape = aSelection->context()->shape();
-     anOriginalShapes.push_back(aShape);
-   }
+   ListOfShape anOriginalFaces;
+   ListOfShape anOriginalSolids;
+   getOriginalShapesAndContexts(BASE_OBJECTS_ID(), anOriginalFaces, anOriginalSolids);
    std::shared_ptr<GeomAlgoAPI_MakeVolume> anAlgo(
-     new GeomAlgoAPI_MakeVolume(anOriginalShapes, false));
+     new GeomAlgoAPI_MakeVolume(anOriginalFaces, false));
    // check and process result of volume maker
    GeomShapePtr aResShape = getSingleSubshape(anAlgo->shape());
-   storeResult(anOriginalShapes, aResShape, anAlgo);
- }
- void BuildPlugin_Solid::storeResult(const ListOfShape& theOriginalShapes,
-                                     const GeomShapePtr& theResultShape,
-                                     const GeomMakeShapePtr& theAlgorithm)
- {
-   ResultBodyPtr aResultBody = document()->createBody(data());
-   aResultBody->store(theResultShape);
-   // Store faces
-   for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
-        anIt != theOriginalShapes.cend();
-        ++anIt)
-   {
-     GeomShapePtr aShape = *anIt;
-     aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::FACE);
-   }
-   setResult(aResultBody);
+   storeResult(anAlgo, anOriginalFaces, anOriginalSolids, aResShape);
  }
  
  GeomShapePtr BuildPlugin_Solid::getSingleSubshape(const GeomShapePtr& theCompound)
index 3c323ee025590890e70e2bdde802e5e0d3607e8c,1ab5168e5772486591c95f47176a710e3989bf6a..f364b94b0f93b7224632c39fbbd6a542ea7d8e69
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017-20xx  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef BuildPlugin_Solid_H_
  #define BuildPlugin_Solid_H_
  
  #include "BuildPlugin.h"
- #include <GeomAPI_Shape.h>
- #include <ModelAPI_Feature.h>
- class GeomAlgoAPI_MakeShape;
+ #include "BuildPlugin_Shape.h"
  
  /// \class BuildPlugin_Solid
  /// \ingroup Plugins
  /// \brief Feature for creation of solid from faces or shells.
- class BuildPlugin_Solid: public ModelAPI_Feature
+ class BuildPlugin_Solid: public BuildPlugin_Shape
  {
  public:
    /// Use plugin manager for features creation
    BUILDPLUGIN_EXPORT virtual void execute();
  
  protected:
-   /// Store result of algorithm
-   void storeResult(const ListOfShape& theOriginalShapes,
-                    const GeomShapePtr& theResultShape,
-                    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
    /// Explode compound to get single shape
    GeomShapePtr getSingleSubshape(const GeomShapePtr& theCompound);
  };
index 7dbc38e9d76f1a90a384b76631f7bb4378a08d49,de035b915a93966add2846987d278a11470805c3..4c7c8a4fc8afbbceb1fb1f1b6a1820c95730cc1f
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "BuildPlugin_Validators.h"
@@@ -246,9 -247,8 +246,8 @@@ bool BuildPlugin_ValidatorBaseForFace::
      }
  
      // Check that selected objects have closed contours.
-     ListOfShape aFaces;
-     GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
-                                            aPln->direction(), anEdges, aFaces);
+     GeomAlgoAPI_SketchBuilder aBuilder(aPln, anEdges);
+     const ListOfShape& aFaces = aBuilder.faces();
      if(aFaces.empty()) {
        theError = "Selected objects do not generate closed contour.";
        return false;
index 5d24b41255b2891b253ac8dc7f4b43857eb71822,b1fb9f155f5f2d6b39d7301df56d4c85c3d3b830..f22f6598bbc9d5a385958abcfa4c4ca2c253a770
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2014-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  INCLUDE(Common)
  INCLUDE(UnitTest)
@@@ -31,6 -32,7 +31,7 @@@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DI
  SET(PROJECT_HEADERS
      BuildPlugin.h
      BuildPlugin_Plugin.h
+     BuildPlugin_Shape.h
      BuildPlugin_Vertex.h
      BuildPlugin_Edge.h
      BuildPlugin_Wire.h
@@@ -48,6 -50,7 +49,7 @@@
  
  SET(PROJECT_SOURCES
      BuildPlugin_Plugin.cpp
+     BuildPlugin_Shape.cpp
      BuildPlugin_Vertex.cpp
      BuildPlugin_Edge.cpp
      BuildPlugin_Wire.cpp
@@@ -119,6 -122,7 +121,7 @@@ ADD_UNIT_TESTS(TestVertex.p
                 TestCompSolid.py
                 TestCompound.py
                 TestCompound_ErrorMsg.py
+                TestCompound_History.py
                 TestSubShapes.py
                 TestSubShapes_ErrorMsg.py
                 TestFilling.py
index ea7505203d7167b561924fc47f487040fab5a523,e2c5e1ef56d1270d566d2e18595aeb27bfeea930..1ed8befc4f43f3d7a83bd2e8bccfb80c1d671b2b
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2014-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  INCLUDE(Common)
  INCLUDE(UnitTest)
@@@ -34,7 -35,7 +34,7 @@@ SET(PROJECT_HEADER
      CollectionPlugin_Field.h
      CollectionPlugin_WidgetCreator.h
      CollectionPlugin_WidgetField.h
-       CollectionPlugin_Validators.h
+     CollectionPlugin_Validators.h
  )
  
  SET(PROJECT_MOC_HEADERS
@@@ -47,7 -48,7 +47,7 @@@ SET(PROJECT_SOURCE
      CollectionPlugin_Field.cpp
      CollectionPlugin_WidgetCreator.cpp
      CollectionPlugin_WidgetField.cpp
-       CollectionPlugin_Validators.cpp
+     CollectionPlugin_Validators.cpp
  )
  
  SET(XML_RESOURCES
@@@ -107,8 -108,24 +107,24 @@@ ADD_UNIT_TESTS
                 TestGroup2.py
                 TestField.py
                 TestGroup1799.py
-                TestGroupMove.py
-                TestGroupMove2.py
-                TestGroupMove3.py
+                TestGroupMove01.py
+                TestGroupMove02.py
+                TestGroupMove03.py
+                TestGroupMove04.py
+                TestGroupMove05.py
+                TestGroupMove06.py
+                TestGroupMove07.py
+                TestGroupMove08.py
+                TestGroupMove09.py
+                TestGroupMove10.py
+                TestGroupMove11.py
+                TestGroupMove12.py
+                TestGroupMove13.py
+                TestGroupMove14.py
+                TestGroupMove15.py
+                TestGroupMove16.py
+                TestGroupMove17.py
+                TestGroupMove18.py
+                TestGroupMove19.py
                 TestGroupShareTopology.py
  )
index 0000000000000000000000000000000000000000,604989e39385f35ba50ed42bf8a6a4ed11b436e8..fb3768c8caae5c36c7834c87adf91f2896c294da
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,50 +1,49 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
++# Copyright (C) 2014-2019  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
++# License as published by the Free Software Foundation; either
++# version 2.1 of the License, or (at your option) any later version.
++#
++# This library is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++# Lesser General Public License for more details.
++#
++# 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
++#
++# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
++#
+ # Test that box partitioned is splitted: group with edge becomes 2 edges group,
+ # group with not-touched vertex keeps this vertex.
+ from salome.shaper import model
+ from ModelAPI import *
+ model.begin()
+ partSet = model.moduleDocument()
+ Part_1 = model.addPart(partSet)
+ Part_1_doc = Part_1.document()
+ Box_1 = model.addBox(Part_1_doc, 20, 10, 10)
+ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True)
+ Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+ Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
+ Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+ model.do()
+ # move groups
+ Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature())
+ Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+ model.end()
+ # Check groups
+ aFactory = ModelAPI_Session.get().validators()
+ selectionList = Group_1.feature().selectionList("group_list")
+ assert(selectionList.size() == 2)
+ assert(aFactory.validate(Group_1.feature()))
+ selectionList = Group_2.feature().selectionList("group_list")
+ assert(selectionList.size() == 1)
+ assert(aFactory.validate(Group_2.feature()))
index 0000000000000000000000000000000000000000,46f1be056dc99714457b91984df70ee71e451031..e764e5c4c1442cea9cf696aaf4fccc8531a7b017
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,45 +1,44 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
++# Copyright (C) 2014-2019  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
++# License as published by the Free Software Foundation; either
++# version 2.1 of the License, or (at your option) any later version.
++#
++# This library is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++# Lesser General Public License for more details.
++#
++# 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
++#
++# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
++#
+ # Test that removed vertex, selected in the group makes empty group => invalid one
+ from salome.shaper import model
+ from ModelAPI import *
+ model.begin()
+ partSet = model.moduleDocument()
+ Part_1 = model.addPart(partSet)
+ Part_1_doc = Part_1.document()
+ Box_1 = model.addBox(Part_1_doc, 10, 10, 20)
+ Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"))
+ Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
+ Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+ Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1"))
+ Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")])
+ model.do()
+ # move group
+ Part_1_doc.moveFeature(Group_1.feature(), Remove_SubShapes_1.feature())
+ model.end()
+ # Check group
+ aFactory = ModelAPI_Session.get().validators()
+ selectionList = Group_1.feature().selectionList("group_list")
+ assert(selectionList.size() == 0)
+ assert(aFactory.validate(Group_1.feature()) == False)
index 0000000000000000000000000000000000000000,f3c2bda62dc94510bd817b94885bb85cdedba517..495bd4b0720ac9064fa6dfd925f4b3c7b233bd58
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,87 +1,86 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
++# Copyright (C) 2014-2019  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
++# License as published by the Free Software Foundation; either
++# version 2.1 of the License, or (at your option) any later version.
++#
++# This library is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++# Lesser General Public License for more details.
++#
++# 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
++#
++# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
++#
+ # Test that partition divides cylinder into 4 faces, there is no edges in a group moved to the end
+ # Based on the CEA report mail 04.12.2018, page 2
+ from SketchAPI import *
+ from ModelAPI import *
+ from GeomAPI import *
+ from salome.shaper import model
+ model.begin()
+ partSet = model.moduleDocument()
+ Part_1 = model.addPart(partSet)
+ Part_1_doc = Part_1.document()
+ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+ SketchArc_1 = Sketch_1.addArc(-1.103476974288834e-12, 24.99999999999979, 24.49489742783218, 30, 0, 50, False)
+ SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+ SketchLine_1 = SketchProjection_1.createdFeature()
+ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
+ SketchLine_2 = Sketch_1.addLine(0, 50, -10, 50)
+ SketchLine_2.setAuxiliary(True)
+ SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint())
+ SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result())
+ SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result())
+ SketchLine_3 = Sketch_1.addLine(24.49489742783218, 30, 24.49489742783218, 5)
+ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint())
+ SketchLine_4 = Sketch_1.addLine(24.49489742783218, 5, 34.49489742783218, 5)
+ SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+ SketchLine_5 = Sketch_1.addLine(34.49489742783218, 5, 34.49489742783218, 0)
+ SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+ SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+ SketchLine_6 = SketchProjection_2.createdFeature()
+ SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
+ SketchLine_7 = Sketch_1.addLine(34.49489742783218, 0, 0, 0)
+ SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
+ SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint())
+ SketchLine_8 = Sketch_1.addLine(0, 50, 0, 0)
+ SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_8.startPoint())
+ SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.endPoint())
+ SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
+ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
+ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 10)
+ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 5)
+ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 25)
+ SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 50)
+ SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_2.result(), 10)
+ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 25)
+ model.do()
+ Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+ Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3")])
+ Partition_1_objects = [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/YOZ")]
+ Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+ model.do()
+ # move group
+ Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature())
+ model.end()
+ # Check group: result must be four faces
+ aFactory = ModelAPI_Session.get().validators()
+ selectionList = Group_1.feature().selectionList("group_list")
+ assert(selectionList.size() == 4)
+ assert(aFactory.validate(Group_1.feature()))
+ for i in range(4):
+   assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+ assert(model.checkPythonDump())
index 2c7b1e2bb4c57c73f182bddafbd6ce51668a19ab,0a7813bcd95f102c454b5568c0d88b6b7a7707e9..70a5a6fcd2e79b629aedc4ce6ead5c6d42e7179e
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2014-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  INCLUDE(Common)
  INCLUDE(UnitTest)
@@@ -356,10 -357,12 +356,12 @@@ ADD_UNIT_TESTS(TestExtrusion.p
                 TestBooleanCut_WireCompound_WireCompound.py
                 TestBooleanCut_Compound_Solid.py
                 TestBooleanCut_ErrorMsg.py
+                TestBooleanCut_SolidsHistory.py
                 TestBooleanSmash_Face_Face.py
                 TestBooleanSmash_SubSolid_Solid.py
                 TestBooleanSmash_CompSolid_Solid.py
                 TestBooleanSmash_ErrorMsg.py
+                TestBooleanSmash_SolidsHistory.py
                 TestBooleanFuse_SimpleMode.py
                 TestBooleanFuse_RemoveEdges.py
                 TestBooleanFuse_ErrorMsg.py
                 TestBooleanCommon_CompSolidCompound_Shell.py
                 TestBooleanCommon_CompSolidCompound_CompSolidCompound.py
                 TestBooleanCommon_ErrorMsg.py
+                TestBooleanCommon_SolidsHistory.py
                 Test2596.py
                 Test2592.py
                 Test2588.py
                 TestPartitionSubCompsolidWithPlane3.py
                 TestPartitionSubCompsolidWithPlane4.py
                 TestPartitionSubCompsolidWithPlane5.py
 +               TestPartitionArgsUpdate.py
+                TestPartition_SolidsHistory.py
                 TestBooleanFuse_Vertex_Vertex.py
                 TestBooleanFuse_VertexCompound_VertexCompound.py
                 TestBooleanFuse_Edge_Edge.py
                 TestBooleanFuse_CompSolid_Face.py
                 TestBooleanFuse_CompSolid_CompSolid.py
                 TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
+                TestBooleanFuse_SolidsHistory.py
                 TestFillet.py
                 TestFillet1.py
                 TestFillet_ErrorMsg.py
+                TestFillet_History.py
                 TestScale1.py
                 TestScale2.py
                 Test1816.py
+                Test1876.py
                 Test2631.py
+                Test2636.py
                 Test2650.py
                 Test2681.py
                 Test2686.py
                 Test2692.py
                 Test2617.py
                 Test2729.py
+                Test2738.py
                 Test2751.py
+                Test2826.py
 +               Test2854.py
  )
index 26deb15c0be7c0ae8f0b0df986d60be934da7c89,fcc48e084bd18de9c0a2904f1060b00aac07204d..eb23d0bab2fe563e12263c35936482224cba2bec
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_BooleanCommon.h"
@@@ -157,13 -158,14 +157,14 @@@ void FeaturesPlugin_BooleanCommon::exec
        std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
-       GeomShapePtr aBaseShape = anObjects.front();
-       anObjects.pop_front();
+       ListOfShape anEmptyTools;
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aBaseShape,
                                                 anObjects,
+                                                anEmptyTools,
                                                 aMakeShapeList,
                                                 aShape);
+       GeomShapePtr aBaseShape = anObjects.front();
+       anObjects.pop_front();
        setResult(aResultBody, aResultIndex);
        aResultIndex++;
  
        if (aShapeIt.more() || aResShape->shapeType() == GeomAPI_Shape::VERTEX) {
          std::shared_ptr<ModelAPI_ResultBody> aResultBody =
            document()->createBody(data(), aResultIndex);
+         ListOfShape anObjectList;
+         anObjectList.push_back(anObject);
          FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                  anObject,
+                                                  anObjectList,
                                                   aTools,
                                                   aMakeShapeList,
                                                   aResShape);
          std::shared_ptr<ModelAPI_ResultBody> aResultBody =
            document()->createBody(data(), aResultIndex);
  
+         ListOfShape aCompSolidList;
+         aCompSolidList.push_back(aCompSolid);
          FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                  aCompSolid,
+                                                  aCompSolidList,
                                                   aTools,
                                                   aMakeShapeList,
                                                   aResultShape);
          std::shared_ptr<ModelAPI_ResultBody> aResultBody =
            document()->createBody(data(), aResultIndex);
  
+         ListOfShape aCompoundList;
+         aCompoundList.push_back(aCompound);
          FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                  aCompound,
+                                                  aCompoundList,
                                                   aTools,
                                                   aMakeShapeList,
                                                   aResultShape);
index 784ef8f2b711287d51f949e6b1e19420df58a1b7,a37a4a56c140a04239197434cd19b966c33c7026..04b9020ba0858e837393e6d29b78b4487b60a4ad
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_BooleanCut.h"
@@@ -132,8 -133,10 +132,10 @@@ void FeaturesPlugin_BooleanCut::execute
        std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
+       ListOfShape anObjectList;
+       anObjectList.push_back(anObject);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                anObject,
+                                                anObjectList,
                                                 aTools,
                                                 aMakeShapeList,
                                                 aResShape);
        std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
+       ListOfShape anObjectList;
+       anObjectList.push_back(aCompSolid);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aCompSolid,
+                                                anObjectList,
                                                 aTools,
                                                 aMakeShapeList,
                                                 aResultShape);
        std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
+       ListOfShape anObjectList;
+       anObjectList.push_back(aCompound);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aCompound,
+                                                anObjectList,
                                                 aTools,
                                                 aMakeShapeList,
                                                 aResultShape);
index 1fecf3926810c3549faa81ee3bb7bc149c784a3f,27b46bc03cf2867fffd6af5051a609afb55b6b00..92d513e5c521252197ea3dedfccc1ab0418426a3
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_BooleanFill.h"
+ #include "FeaturesPlugin_Tools.h"
  
  #include <ModelAPI_ResultBody.h>
  #include <ModelAPI_AttributeSelectionList.h>
  #include <ModelAPI_Tools.h>
  
  #include <GeomAlgoAPI_Boolean.h>
+ #include <GeomAlgoAPI_CompoundBuilder.h>
  #include <GeomAlgoAPI_MakeShapeCustom.h>
  #include <GeomAlgoAPI_MakeShapeList.h>
  #include <GeomAlgoAPI_Partition.h>
@@@ -105,6 -108,9 +107,9 @@@ void FeaturesPlugin_BooleanFill::execut
      return;
    }
  
+   std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+   ListOfShape aResultShapesList;
    // For solids cut each object with all tools.
    for(ListOfShape::iterator
        anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
      std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
+     // tools should be added to the list to fulfill the correct history of modification
+     aListWithObject.insert(aListWithObject.end(), aTools.begin(), aTools.end());
      ListOfShape aUsedTools = aTools;
      aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
  
-     loadNamingDS(aResultBody, anObject, aUsedTools, aResShape, aMakeShapeList);
+     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aListWithObject, aUsedTools,
+                                              aMakeShapeList, aResShape);
      setResult(aResultBody, aResultIndex);
      aResultIndex++;
+     FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+     aRBA.resultBody = aResultBody;
+     aRBA.baseShape = anObject;
+     aRBA.makeShape = aMakeShapeList;
+     aResultBaseAlgoList.push_back(aRBA);
+     aResultShapesList.push_back(aResShape);
    }
  
    // Compsolids handling
      ListOfShape aUsedTools = aTools;
      aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
  
-     loadNamingDS(aResultBody,
-                   aCompSolid,
-                   aUsedTools,
-                   aResultShape,
-                   aMakeShapeList);
+     ListOfShape aBaseShapes;
+     aBaseShapes.push_back(aCompSolid);
+     // tools should be added to the list to fulfill the correct history of modification
+     aBaseShapes.insert(aBaseShapes.end(), aTools.begin(), aTools.end());
+     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, aUsedTools,
+                                              aMakeShapeList, aResultShape);
      setResult(aResultBody, aResultIndex);
      aResultIndex++;
+     FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+     aRBA.resultBody = aResultBody;
+     aRBA.baseShape = aCompSolid;
+     aRBA.makeShape = aMakeShapeList;
+     aResultBaseAlgoList.push_back(aRBA);
+     aResultShapesList.push_back(aResultShape);
    }
  
+   // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
+   // result shape has been deleted, but in another it was modified or stayed.
+   GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+   FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
    // remove the rest results if there were produced in the previous pass
    removeResults(aResultIndex);
  }
index 6c3f272110da56800631912596a97415b1b8ca7b,b8bec11c1a17d8e39e4c76f02350db5e450f1793..176e8b6fe9eecbfb5e28d458ed58bc7f1c3aec0a
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_BooleanFuse.h"
@@@ -270,20 -271,19 +270,19 @@@ void FeaturesPlugin_BooleanFuse::execut
  
    int aResultIndex = 0;
  
-   GeomShapePtr aBackShape = anOriginalShapes.back();
-   anOriginalShapes.pop_back();
    ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
  
+   ListOfShape anEmptyTools;
    FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                            aBackShape,
                                             anOriginalShapes,
+                                            anEmptyTools,
                                             aMakeShapeList,
                                             aShape);
    setResult(aResultBody, aResultIndex);
    aResultIndex++;
  
    FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
-                                           aBackShape,
+                                           GeomShapePtr(),
                                            anOriginalShapes,
                                            aMakeShapeList,
                                            aShape);
index 46d7b202135bac4e0faad5a5d5dad2a0edeca944,2ec4468c4ac306b50c13775c39890308746404c2..9c8bb1e578bffda2db38ab2ccc6990304361f277
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_BooleanSmash.h"
@@@ -212,12 -213,10 +212,10 @@@ void FeaturesPlugin_BooleanSmash::execu
      aMakeShapeList->appendAlgo(aFillerAlgo);
    }
  
-   std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
-   anOriginalShapes.pop_front();
    std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
  
    FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                            aFrontShape,
+                                            anOriginalShapes,
                                             anOriginalShapes,
                                             aMakeShapeList,
                                             aShape);
    aResultIndex++;
  
    FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
-                                           aFrontShape,
+                                           GeomShapePtr(),
                                            anOriginalShapes,
                                            aMakeShapeList,
                                            aShape);
index 89c07b94e8542c55dc5031fa4a9925416617523b,0782bbb12990682df74235707ad32383882fbd0c..8dcd2fae4e5383a3ebe1aa74ecf7d24b1c2a7114
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_Fillet.h"
+ #include "FeaturesPlugin_Tools.h"
  
  #include <ModelAPI_Data.h>
  #include <ModelAPI_AttributeDouble.h>
@@@ -28,6 -30,7 +29,7 @@@
  #include <ModelAPI_Tools.h>
  #include <ModelAPI_Validator.h>
  
+ #include <GeomAlgoAPI_CompoundBuilder.h>
  #include <GeomAlgoAPI_Fillet.h>
  #include <GeomAlgoAPI_MakeShapeList.h>
  #include <GeomAlgoAPI_Tools.h>
@@@ -61,7 -64,7 +63,7 @@@ static ListOfShape selectEdges(const Li
    return anEdges;
  }
  
- // If theShape is a compound of single shape, return it
+ // If theShape is a compound of a single sub-shape, return this sub-shape
  static GeomShapePtr unwrapCompound(const GeomShapePtr& theShape)
  {
    GeomShapePtr aShape = theShape;
@@@ -101,9 -104,9 +103,9 @@@ void FeaturesPlugin_Fillet::execute(
    if (!aCreationMethod)
      return;
  
-   GeomAPI_DataMapOfShapeMapOfShapes aSolidsAndSubs;
+   std::list<std::pair<GeomShapePtr, ListOfShape> > aSolidsAndSubs;
  
-   // getting objects and sort them accroding to parent solids
+   // getting objects and sort them according to parent solids
    AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECT_LIST_ID());
    for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); ++anObjectsIndex) {
      AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
      if (!aParent)
        return;
  
+     // searching this parent is already in the list aSolidsAndSubs
+     std::list<std::pair<GeomShapePtr, ListOfShape> >::iterator aSearch = aSolidsAndSubs.begin();
+     ListOfShape* aFound;
+     for(; aSearch != aSolidsAndSubs.end(); aSearch++) {
+       if (aSearch->first->isSame(aParent)) {
+         aFound = &(aSearch->second);
+         break;
+       }
+     }
+     if (aSearch == aSolidsAndSubs.end()) { // not found, so, add a new one
+       aSolidsAndSubs.push_back(std::pair<GeomShapePtr, ListOfShape>(aParent, ListOfShape()));
+       aFound = &(aSolidsAndSubs.back().second);
+     }
      ListOfShape anEdgesAndVertices;
      collectSubs(anObject, anEdgesAndVertices, GeomAPI_Shape::EDGE);
      collectSubs(anObject, anEdgesAndVertices, GeomAPI_Shape::VERTEX);
      for (ListOfShape::iterator aEIt = anEdgesAndVertices.begin();
           aEIt != anEdgesAndVertices.end(); ++aEIt)
-       aSolidsAndSubs.add(aParent, *aEIt);
+       aFound->push_back(*aEIt);
    }
  
    bool isFixedRadius = true;
    int aResultIndex = 0;
    std::string anError;
  
-   GeomAPI_DataMapOfShapeMapOfShapes::iterator anIt = aSolidsAndSubs.begin();
+   std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+   ListOfShape anOriginalShapesList, aResultShapesList;
+   std::list<std::pair<GeomShapePtr, ListOfShape> >::iterator anIt = aSolidsAndSubs.begin();
    for (; anIt != aSolidsAndSubs.end(); ++anIt) {
-     GeomShapePtr aSolid = anIt.first();
-     ListOfShape aFilletEdgesAndVertices = anIt.second();
+     GeomShapePtr aSolid = anIt->first;
+     ListOfShape aFilletEdgesAndVertices = anIt->second;
  
      ListOfShape aFilletEdges = selectEdges(aFilletEdgesAndVertices);
      if (isFixedRadius)
      std::shared_ptr<ModelAPI_ResultBody> aResultBody =
          document()->createBody(data(), aResultIndex);
  
-     loadNamingDS(aResultBody, aSolid, aResult, aFilletBuilder);
+     ListOfShape aBaseShapes;
+     aBaseShapes.push_back(aSolid);
+     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+                                              aFilletBuilder, aResult, "Fillet");
      setResult(aResultBody, aResultIndex);
      aResultIndex++;
-   }
-   removeResults(aResultIndex);
- }
  
- void FeaturesPlugin_Fillet::loadNamingDS(
-     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-     const std::shared_ptr<GeomAPI_Shape> theResultShape,
-     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
- {
-   //load result
-   if(theBaseShape->isEqual(theResultShape)) {
-     theResultBody->store(theResultShape, false);
-     return;
+     FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+     aRBA.resultBody = aResultBody;
+     aRBA.baseShape = aSolid;
+     aRBA.makeShape = aFilletBuilder;
+     aResultBaseAlgoList.push_back(aRBA);
+     aResultShapesList.push_back(aResult);
+     anOriginalShapesList.push_back(aSolid);
+     const std::string aFilletFaceName = "Fillet";
+     ListOfShape::iterator aSelectedBase = aFilletEdges.begin();
+     for(; aSelectedBase != aFilletEdges.end(); aSelectedBase++) {
+       GeomShapePtr aBase = *aSelectedBase;
+       // Store new faces generated from edges and vertices
+       aResultBody->loadGeneratedShapes(
+         aFilletBuilder, aBase, GeomAPI_Shape::EDGE, aFilletFaceName, true);
+     }
    }
  
-   theResultBody->storeModified(theBaseShape, theResultShape);
+   // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
+   // result shape has been deleted, but in another it was modified or stayed.
+   GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+   FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
+       anOriginalShapesList, aResultShapesCompound);
  
-   const std::string aFilletFaceName = "Fillet_Face";
-   // Store modified faces
-   theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
-   // Store new faces generated from edges and vertices
-   theResultBody->loadGeneratedShapes(theMakeShape,
-                                      theBaseShape,
-                                      GeomAPI_Shape::EDGE,
-                                      aFilletFaceName);
-   theResultBody->loadGeneratedShapes(theMakeShape,
-                                      theBaseShape,
-                                      GeomAPI_Shape::VERTEX,
-                                      aFilletFaceName);
-   // Deleted shapes
-   theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
-   theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
+   removeResults(aResultIndex);
  }
index c7a9f62c2c31fd519ecfbab4ac141b9280d260ee,a127d2efd658fd0b517d636101352aa5a0a23ca5..7a1e75453a33877c9aa406ae976cf3b5d017f293
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_FusionFaces.h"
+ #include "FeaturesPlugin_Tools.h"
  
  #include <ModelAPI_AttributeSelectionList.h>
  #include <ModelAPI_AttributeString.h>
@@@ -69,13 -71,10 +70,10 @@@ void FeaturesPlugin_FusionFaces::execut
    // Store result
    GeomShapePtr aResultShape = anAlgo->shape();
    ResultBodyPtr aResultBody = document()->createBody(data());
-   if (aResultShape->isEqual(aBaseShape)) {
-     aResultBody->store(aResultShape);
-   } else {
-     aResultBody->storeModified(aBaseShape, aResultShape);
  
-     aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::EDGE);
-     aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::FACE);
-   }
+   ListOfShape aBaseShapesList;
+   aBaseShapesList.push_back(aBaseShape);
+   FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(),
+                                            anAlgo, aResultShape);
    setResult(aResultBody);
  }
index 9d6e6ebe910b1af07269333b0b8e165502d55c0d,471e0cff18d272a5ed88810b58472aae9a83a60a..1fa9079247f632a9cf86732de0a28b271bfada7e
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_Intersection.h"
@@@ -82,7 -83,6 +82,6 @@@ void FeaturesPlugin_Intersection::execu
    setResult(aResultBody, aResultIndex);
    aResultIndex++;
  
    // remove the rest results if there were produced in the previous pass
    removeResults(aResultIndex);
  }
@@@ -99,7 -99,7 +98,7 @@@ void FeaturesPlugin_Intersection::loadN
      return;
    }
  
-   theResultBody->storeModified(theObjects.front(), aResultShape);
+   theResultBody->storeModified(theObjects, aResultShape, theMakeShape);
  
    const int aShapeTypesNb = 3;
    const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] = {GeomAPI_Shape::VERTEX,
index cc60873c417bf5ad5f8684314124d5018375eba7,a570ea8da1d019f2fd083fd30c372d591bd0b1f0..64286a9d7e6d8b70f52cbdfca3d2debc18a95d97
@@@ -1,29 -1,14 +1,31 @@@
 -// Copyright (C) 2014-201x CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
 +// License as published by the Free Software Foundation; either
 +// version 2.1 of the License, or (at your option) any later version.
 +//
 +// This library is distributed in the hope that it will be useful,
 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +// Lesser General Public License for more details.
 +//
 +// 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
 +//
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +//
  
  // File:        FeaturesPlugin_MultiRotation.cpp
  // Created:     30 Jan 2017
  // Author:      Clarisse Genrault (CEA)
  
  #include <FeaturesPlugin_MultiRotation.h>
+ #include <FeaturesPlugin_Tools.h>
  
  #include <GeomAlgoAPI_CompoundBuilder.h>
+ #include <GeomAlgoAPI_MakeShapeList.h>
  #include <GeomAlgoAPI_ShapeTools.h>
  #include <GeomAlgoAPI_Tools.h>
  #include <GeomAlgoAPI_Translation.h>
@@@ -193,7 -178,8 +195,8 @@@ void FeaturesPlugin_MultiRotation::perf
      } else {
        std::string anError;
        ListOfShape aListOfShape;
-       std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > aListOfRotationAlgo;
+       std::shared_ptr<GeomAlgoAPI_MakeShapeList>
+           aListOfRotationAlgo(new GeomAlgoAPI_MakeShapeList);
  
        for (int i=0; i<nbCopies; i++) {
          std::shared_ptr<GeomAlgoAPI_Rotation> aRotationnAlgo(
            break;
          }
          aListOfShape.push_back(aRotationnAlgo->shape());
-         aListOfRotationAlgo.push_back(aRotationnAlgo);
+         aListOfRotationAlgo->appendAlgo(aRotationnAlgo);
        }
        std::shared_ptr<GeomAPI_Shape> aCompound =
          GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aCompound);
-       loadNamingDS(aListOfRotationAlgo, aResultBody, aBaseShape);
+       ListOfShape aBaseShapes;
+       aBaseShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+                                                aListOfRotationAlgo, aCompound, "Rotated");
  
        setResult(aResultBody, aResultIndex);
      }
@@@ -458,22 -447,3 +464,3 @@@ void FeaturesPlugin_MultiRotation::load
    }
  }
  #endif
- //=================================================================================================
- void FeaturesPlugin_MultiRotation::loadNamingDS(
-     std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
-     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-     std::shared_ptr<GeomAPI_Shape> theBaseShape)
- {
-   for (std::list<std::shared_ptr<GeomAlgoAPI_Rotation> >::const_iterator anIt =
-     theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) {
-     // naming of faces
-     theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face");
-     // naming of edges
-     theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge");
-     // naming of vertex
-     theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex");
-   }
- }
index 477d6b62fc622bf2dcfde37ebc73fff6e7d8f271,96e9df0946fbbf94f12101da2bca805ae1a53edd..f7dc3dc8d304ce105ca0011301e3959ab38b90e8
@@@ -1,21 -1,4 +1,21 @@@
 -// Copyright (C) 2014-201x CEA/DEN, EDF R&D
 +// Copyright (C) 2017-2019  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
 +// License as published by the Free Software Foundation; either
 +// version 2.1 of the License, or (at your option) any later version.
 +//
 +// This library is distributed in the hope that it will be useful,
 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +// Lesser General Public License for more details.
 +//
 +// 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
 +//
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +//
  
  // File:        FeaturesPlugin_MultiRotation.h
  // Created:     30 Jan 2017
@@@ -135,10 -118,6 +135,6 @@@ private
                      std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                      std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
  #endif
-   void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
-                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
  };
  
 -#endif // FEATURESPLUGIN_MULTIROTATION_H_
 +#endif // FEATURESPLUGIN_MULTIROTATION_H_
index d8b241228f20a30495e04fc426c57282ab7afb3f,ed3665792c5d26d4b91c89821494e6971a37f66f..b9af9671352fd044aa1e628b1af8dad648aa5916
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <FeaturesPlugin_MultiTranslation.h>
+ #include <FeaturesPlugin_Tools.h>
  
  #include <GeomAlgoAPI_CompoundBuilder.h>
+ #include <GeomAlgoAPI_MakeShapeList.h>
  #include <GeomAlgoAPI_Tools.h>
  
  #include <GeomAPI_Ax1.h>
@@@ -171,7 -174,8 +173,8 @@@ void FeaturesPlugin_MultiTranslation::p
      } else {
        std::string anError;
        ListOfShape aListOfShape;
-       std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
+       std::shared_ptr<GeomAlgoAPI_MakeShapeList>
+           aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList);
  
        for (int i=0; i<nbCopies; i++) {
          std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
            break;
          }
          aListOfShape.push_back(aTranslationAlgo->shape());
-         aListOfTranslationAlgo.push_back(aTranslationAlgo);
+         aListOfTranslationAlgo->appendAlgo(aTranslationAlgo);
        }
        std::shared_ptr<GeomAPI_Shape> aCompound =
          GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aCompound);
-       loadNamingDS(aListOfTranslationAlgo, aResultBody, aBaseShape);
+       ListOfShape aBaseShapes;
+       aBaseShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+                                                aListOfTranslationAlgo, aCompound, "Translated");
  
        setResult(aResultBody, aResultIndex);
      }
@@@ -360,7 -367,8 +366,8 @@@ void FeaturesPlugin_MultiTranslation::p
      } else {
        std::string anError;
        ListOfShape aListOfShape;
-       std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
+       std::shared_ptr<GeomAlgoAPI_MakeShapeList>
+           aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList);
  
        for (int j=0; j<aSecondNbCopies; j++) {
          for (int i=0; i<aFirstNbCopies; i++) {
              break;
            }
            aListOfShape.push_back(aTranslationAlgo->shape());
-           aListOfTranslationAlgo.push_back(aTranslationAlgo);
+           aListOfTranslationAlgo->appendAlgo(aTranslationAlgo);
          }
        }
        std::shared_ptr<GeomAPI_Shape> aCompound =
          GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aCompound);
-       loadNamingDS(aListOfTranslationAlgo, aResultBody, aBaseShape);
+       ListOfShape aBaseShapes;
+       aBaseShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+                                                aListOfTranslationAlgo, aCompound, "Translated");
        setResult(aResultBody, aResultIndex);
      }
      aResultIndex++;
    // Remove the rest results if there were produced in the previous pass.
    removeResults(aResultIndex);
  }
- //=================================================================================================
- void FeaturesPlugin_MultiTranslation::loadNamingDS(
-     std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
-     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-     std::shared_ptr<GeomAPI_Shape> theBaseShape)
- {
-   for (std::list<std::shared_ptr<GeomAlgoAPI_Translation> >::const_iterator anIt =
-     theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) {
-     // naming of faces
-     theResultBody->loadModifiedShapes(*anIt,
-                                       theBaseShape,
-                                       GeomAPI_Shape::FACE,
-                                       "Translated_Face");
-     // naming of edges
-     theResultBody->loadModifiedShapes(*anIt,
-                                       theBaseShape,
-                                       GeomAPI_Shape::EDGE,
-                                       "Translated_Edge");
-     // naming of vertex
-     theResultBody->loadModifiedShapes(*anIt,
-                                       theBaseShape,
-                                       GeomAPI_Shape::VERTEX,
-                                       "Translated_Vertex");
-   }
- }
index 9c0dfe3840b5f4610cfe03c01a37edc46b40b156,bb28d98e739994bc74bccb2e380e666ea090643d..9571ed3d218c91228b58167d2eadd62c5f625b32
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef FEATURESPLUGIN_MULTITRANSLATION_H_
@@@ -119,10 -120,6 +119,6 @@@ private
  
    /// Perform the multi translation in two directions.
    void performTwoDirection();
-   void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
-                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
  };
  
  #endif // FEATURESPLUGIN_MULTITRANSLATION_H_
index a97985ea40bfff5fb88c3db2600a1a1893ea36f2,8215f029374057be0ab4bc3eb9c3298c1685a1cd..f572664a2cc85c8fa5e71914c0c62a06ee39613c
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_Partition.h"
@@@ -171,37 -172,20 +171,20 @@@ void FeaturesPlugin_Partition::storeRes
    const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
    const int theIndex)
  {
-   // Find base. The most complicated is the real modified object (#1799 if box is partitioned by
-   // two planes the box is the base, not planes, independently on the order in the list).
-   GeomShapePtr aBaseShape;
-   for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
-     GeomShapePtr anObjectShape = *anIt;
-     GeomShapePtr aCandidate =
-       findBase(anObjectShape, theResultShape, GeomAPI_Shape::VERTEX, theMakeShape);
-     if(!aCandidate.get()) {
-       aCandidate = findBase(anObjectShape, theResultShape, GeomAPI_Shape::EDGE, theMakeShape);
-     }
-     if (!aCandidate.get())
-       aCandidate = findBase(anObjectShape, theResultShape, GeomAPI_Shape::FACE, theMakeShape);
-     if(aCandidate.get()) {
-       if (!aBaseShape.get() || aBaseShape->shapeType() > aCandidate->shapeType()) {
-         aBaseShape = aCandidate;
-       }
-     }
-   }
    // Create result body.
    ResultBodyPtr aResultBody = document()->createBody(data(), theIndex);
  
-   // Store modified shape.
-   if(!aBaseShape.get() || aBaseShape->isEqual(theResultShape)) {
-     aResultBody->store(theResultShape, false);
-     setResult(aResultBody, theIndex);
-     return;
+   // if result is same as one of the base object, no modification was performed
+   for(ListOfShape::const_iterator anObj = theObjects.cbegin(); anObj != theObjects.cend(); ++anObj)
+   {
+     if (anObj->get() && (*anObj)->isSame(theResultShape)) {
+       aResultBody->store(theResultShape, false);
+       setResult(aResultBody, theIndex);
+       return;
+     }
    }
  
-   aResultBody->storeModified(aBaseShape, theResultShape);
+   aResultBody->storeModified(theObjects, theResultShape, theMakeShape);
  
    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
    theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end());
  
  //=================     Auxiliary functions     ===================================================
  
- GeomShapePtr findBase(const GeomShapePtr theObjectShape,
-                       const GeomShapePtr theResultShape,
-                       const GeomAPI_Shape::ShapeType theShapeType,
-                       const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
- {
-   GeomShapePtr aBaseShape;
-   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
-   for(GeomAPI_ShapeExplorer anObjectSubShapesExp(theObjectShape, theShapeType);
-       anObjectSubShapesExp.more();
-       anObjectSubShapesExp.next()) {
-     GeomShapePtr anObjectSubShape = anObjectSubShapesExp.current();
-     ListOfShape aModifiedShapes;
-     theMakeShape->modified(anObjectSubShape, aModifiedShapes);
-     for(ListOfShape::const_iterator
-         aModIt = aModifiedShapes.cbegin(); aModIt != aModifiedShapes.cend(); ++aModIt) {
-       GeomShapePtr aModShape = *aModIt;
-       if(aMapOfSubShapes->isBound(aModShape)) {
-         aModShape = aMapOfSubShapes->find(aModShape);
-       }
-       if(theResultShape->isSubShape(aModShape)) {
-         aBaseShape = theObjectShape;
-         break;
-       }
-     }
-     if(aBaseShape.get()) {
-       break;
-     }
-   }
-   return aBaseShape;
- }
  static CompsolidSubs::iterator findOrAdd(CompsolidSubs& theList, const GeomShapePtr& theCompsolid)
  {
    CompsolidSubs::iterator aFound = theList.begin();
index eda3bed26c80d22e277ad3267c4d1252c410f62f,2ea9b9b9f8063b11260214263dd427672d5b2760..0acf3a84e07c22da2d7d80bc2c0757fde884230a
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_Placement.h"
@@@ -166,8 -167,11 +166,11 @@@ void FeaturesPlugin_Placement::execute(
  
        //LoadNamingDS
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aTransformAlgo->shape());
-       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aTransformAlgo, "Placed");
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aShapes, ListOfShape(),
+                                                aTransformAlgo, aTransformAlgo->shape(), "Placed");
        setResult(aResultBody, aResultIndex);
      }
      aResultIndex++;
index bfe4ad1a84cd4774838c4f04c6ef29200bd91b2a,d0754a9dce1e7fedb974268acbd6ad8db4aeb954..7ef1d86b8827fb58468b62ca83b4628ffa0e2124
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <FeaturesPlugin_Rotation.h>
@@@ -172,8 -173,15 +172,15 @@@ void FeaturesPlugin_Rotation::performTr
        }
  
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
-       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                                aShapes,
+                                                ListOfShape(),
+                                                aRotationAlgo,
+                                                aRotationAlgo->shape(),
+                                                "Rotated");
        setResult(aResultBody, aResultIndex);
      }
      aResultIndex++;
@@@ -271,8 -279,15 +278,15 @@@ void FeaturesPlugin_Rotation::performTr
        }
  
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
-       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
+       FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                                aShapes,
+                                                ListOfShape(),
+                                                aRotationAlgo,
+                                                aRotationAlgo->shape(),
+                                                "Rotated");
        setResult(aResultBody, aResultIndex);
      }
      aResultIndex++;
index b1fba3444802d05a0386bd57670a608e9adc0d9b,d46e8fcac278460aa98ae66a607d07b5432b29a9..bdb4cdd52fde517cc999053ac555b78368b7d3f9
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <FeaturesPlugin_Scale.h>
@@@ -137,8 -138,15 +137,15 @@@ void FeaturesPlugin_Scale::performScale
      }
  
      ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-     aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
-     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
+     ListOfShape aShapes;
+     aShapes.push_back(aBaseShape);
+     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                              aShapes,
+                                              ListOfShape(),
+                                              aScaleAlgo,
+                                              aScaleAlgo->shape(),
+                                              "Scaled");
      setResult(aResultBody, aResultIndex);
      aResultIndex++;
    }
@@@ -215,8 -223,15 +222,15 @@@ void FeaturesPlugin_Scale::performScale
      }
  
      ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-     aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
-     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
+     ListOfShape aShapes;
+     aShapes.push_back(aBaseShape);
+     FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+                                              aShapes,
+                                              ListOfShape(),
+                                              aScaleAlgo,
+                                              aScaleAlgo->shape(),
+                                              "Scaled");
      setResult(aResultBody, aResultIndex);
      aResultIndex++;
    }
index a243e55f30b0137cf373080a386e9d27a515da81,a9caa79ecc033863f3850d5899b969e60b619649..38b50f39391e0d19cd01cf266d4ef525c52f57e2
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <FeaturesPlugin_Symmetry.h>
@@@ -369,8 -370,12 +369,12 @@@ void FeaturesPlugin_Symmetry::buildResu
  
    // Store and name the result.
    ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
-   aResultBody->storeModified(theBaseShape, aCompound);
-   FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theBaseShape, anAlgoList, "Symmetried");
+   ListOfShape aBaseShapes;
+   aBaseShapes.push_back(theBaseShape);
+   FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(),
+                                            anAlgoList, aCompound, "Symmetried");
    setResult(aResultBody, theResultIndex);
  }
  
index b484349d08f2f8809b0fd83faf07b42639b9ce5e,2106d4596aba66894eb6d0b99c2496610a7dc1c1..ed96231b4387dc1307117285b224ef157b3e3f5d
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "FeaturesPlugin_Tools.h"
  
  //==================================================================================================
  void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
-                                               const GeomShapePtr theBaseShape,
+                                               const ListOfShape& theBaseShapes,
                                                const ListOfShape& theTools,
                                                const GeomMakeShapePtr& theMakeShape,
-                                               const GeomShapePtr theResultShape)
+                                               const GeomShapePtr theResultShape,
+                                               const std::string& theNamePrefix)
  {
-   if (theBaseShape->isEqual(theResultShape)) {
-     theResultBody->store(theResultShape, false);
-     return;
-   }
+   theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
  
-   theResultBody->storeModified(theBaseShape, theResultShape);
+   ListOfShape aShapes = theBaseShapes;
+   ListOfShape::const_iterator aToolIter = theTools.cbegin();
+   for(; aToolIter != theTools.cend(); aToolIter++)
+     aShapes.push_back(*aToolIter);
  
-   ListOfShape aShapes = theTools;
-   aShapes.push_front(theBaseShape);
+   std::string aVertexName, anEdgeName, aFaceName;
+   if (!theNamePrefix.empty()) {
+     aVertexName = theNamePrefix + "_Vertex";
+     anEdgeName = theNamePrefix + "_Edge";
+     aFaceName = theNamePrefix + "_Face";
+   }
  
    for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
    {
-     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX);
-     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE);
-     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
+     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aVertexName);
+     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE, anEdgeName);
+     theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE, aFaceName);
    }
  }
  
  //==================================================================================================
  void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
-                                               const GeomShapePtr theBaseShape,
+                                               const GeomShapePtr& theBaseShape,
                                                const GeomMakeShapePtr& theMakeShape,
                                                const std::string theName)
  {
@@@ -97,7 -103,8 +102,8 @@@ void FeaturesPlugin_Tools::loadDeletedS
    const GeomShapePtr theResultShapesCompound)
  {
    ListOfShape aShapes = theTools;
-   aShapes.push_front(theBaseShape);
+   if (theBaseShape.get())
+     aShapes.push_front(theBaseShape);
  
    for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
    {
index 395079bb57399ca4476c2e6c5a333cfdfba76213,815cfade0e622edb4fc17320cc3771c0ff6eebff..dd04de569f511a3517ccc12b7604ac69afe31ea3
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef FeaturesPlugin_Tools_H_
@@@ -35,16 -36,16 +35,16 @@@ public
  
  public:
    static void loadModifiedShapes(ResultBodyPtr theResultBody,
-                                  const GeomShapePtr theBaseShape,
+                                  const ListOfShape& theBaseShapes,
                                   const ListOfShape& theTools,
                                   const GeomMakeShapePtr& theMakeShape,
-                                  const GeomShapePtr theResultShape);
+                                  const GeomShapePtr theResultShape,
+                                  const std::string& theNamePrefix = "");
  
    static void loadModifiedShapes(ResultBodyPtr theResultBody,
-                                  const GeomShapePtr theBaseShape,
+                                  const GeomShapePtr& theBaseShape,
                                   const GeomMakeShapePtr& theMakeShape,
                                   const std::string theName);
      /// Stores deleted shapes.
    static void loadDeletedShapes(ResultBodyPtr theResultBody,
                                  const GeomShapePtr theBaseShape,
index 4e6d57073988c87869413f9f5be6af989a447ae3,93ac6a19bcb42a58828d54b181ee9965eef8411e..eff54dc689f759480f280cca2cc47ef3a11f5a39
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <FeaturesPlugin_Translation.h>
@@@ -184,10 -185,14 +184,14 @@@ void FeaturesPlugin_Translation::perfor
        }
  
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aBaseShape,
+                                                aShapes,
+                                                ListOfShape(),
                                                 aTranslationAlgo,
+                                                aTranslationAlgo->shape(),
                                                 "Translated");
        setResult(aResultBody, aResultIndex);
      }
@@@ -260,10 -265,14 +264,14 @@@ void FeaturesPlugin_Translation::perfor
        }
  
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aBaseShape,
+                                                aShapes,
+                                                ListOfShape(),
                                                 aTranslationAlgo,
+                                                aTranslationAlgo->shape(),
                                                 "Translated");
        setResult(aResultBody, aResultIndex);
      }
@@@ -349,10 -358,14 +357,14 @@@ void FeaturesPlugin_Translation::perfor
        }
  
        ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-       aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+       ListOfShape aShapes;
+       aShapes.push_back(aBaseShape);
        FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
-                                                aBaseShape,
+                                                aShapes,
+                                                ListOfShape(),
                                                 aTranslationAlgo,
+                                                aTranslationAlgo->shape(),
                                                 "Translated");
        setResult(aResultBody, aResultIndex);
      }
index cef3c5768d09e373b9cb3077ebca7f6944a972bd,efd3de9c8217685df11f4f76210902b18e31815d..d11aaaca1731cd0dd7e2e6c711c59981d9357cf2
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2014-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  # -*- coding: utf-8 -*-
  
@@@ -183,7 -184,19 +183,19 @@@ Plane_5 = model.addPlane(Part_1_doc, mo
  Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
  Face_1 = model.addFace(Part_1_doc, Face_1_objects)
  Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Recover_1_1"), model.selection("FACE", "Face_1_1")])
- Group_1_objects = [model.selection("VERTEX", "[Intersection_1_1_3/Intersection_1_1_3&Face_1_1/Edge_3][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_9/Intersection_1_1_9&Face_1_1/Edge_7][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_7/Intersection_1_1_7&Face_1_1/Edge_5][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_2/Intersection_1_1_2&Face_1_1/Edge_2][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_6/Intersection_1_1_6&Face_1_1/Edge_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_10/Intersection_1_1_10&Face_1_1/Edge_8][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_8/Intersection_1_1_8&Face_1_1/Edge_6][weak_name_1]")]
+ Group_1_objects = [
+ model.selection("VERTEX", "[Intersection_1_1_3/Intersection_1_1_3&Face_1_1/Edge_3][weak_name_2]"),
+ model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_2]"),
+ model.selection("VERTEX", "[Intersection_1_1_9/Intersection_1_1_9&Face_1_1/Edge_7][weak_name_1]"),
+ model.selection("VERTEX", "[Intersection_1_1_7/Intersection_1_1_7&Face_1_1/Edge_5][weak_name_2]"),
+ model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_2]"),
+ model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_1]"),
+ model.selection("VERTEX", "[Intersection_1_1_2/Intersection_1_1_2&Face_1_1/Edge_2][weak_name_1]"),
+ model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_1]"),
+ model.selection("VERTEX", "[Intersection_1_1_6/Intersection_1_1_6&Face_1_1/Edge_4][weak_name_2]"),
+ model.selection("VERTEX", "[Intersection_1_1_10/Intersection_1_1_10&Face_1_1/Edge_8][weak_name_1]"),
+ model.selection("VERTEX", "[Intersection_1_1_8/Intersection_1_1_8&Face_1_1/Edge_6][weak_name_1]")]
  Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
  Group_2_objects = [model.selection("EDGE", "Intersection_1_1_7"), model.selection("EDGE", "Intersection_1_1_6"), model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_11"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1"), model.selection("EDGE", "Intersection_1_1_4"), model.selection("EDGE", "Intersection_1_1_2"), model.selection("EDGE", "Intersection_1_1_10"), model.selection("EDGE", "Intersection_1_1_9"), model.selection("EDGE", "Intersection_1_1_8")]
  Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
index ed1f347aa3c1118dbc5d83b9ec177d764bcfbfc9,7427c4e72dc96e27921453b0734578b8c093ed1d..7036f55378ede29acbbcf26dc3c9ae31e06c9320
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "GeomAPI_Shape.h"
@@@ -688,3 -689,9 +688,9 @@@ bool GeomAPI_Shape::isSelfIntersected(c
  
    return false;
  }
+ bool GeomAPI_Shape::Comparator::operator()(const std::shared_ptr<GeomAPI_Shape>& theShape1,
+                                            const std::shared_ptr<GeomAPI_Shape>& theShape2) const
+ {
+   return theShape1->impl<TopoDS_Shape>().TShape() < theShape2->impl<TopoDS_Shape>().TShape();
+ }
index b15da00b26f321a753a80ca26510ec5040f9006c,d0bc66339fef8778b8a6ab01864de3d5a201087f..cf3222bca246fc178d895d381812016bebdc9121
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef GeomAPI_Shape_H_
@@@ -218,6 -219,16 +218,16 @@@ public
    /// 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;<br>
    /// 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
    GEOMAPI_EXPORT bool isSelfIntersected(const int theLevelOfCheck = 9) const;
+ public:
+   class Comparator
+   {
+   public:
+     /// Return \c true if the address of the first shape is less than the address of the second
+     GEOMAPI_EXPORT
+     bool operator ()(const std::shared_ptr<GeomAPI_Shape>& theShape1,
+                      const std::shared_ptr<GeomAPI_Shape>& theShape2) const;
+   };
  };
  
  //! Pointer on list of shapes
index e5625c5c6c7d006be804d98d8b4207ff4657fa79,8fb19d4baad16e6fed5a9495b0eb3ffb3ab06af7..d1c014e1b6d0783a541d7fc46f32425296787b87
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  /* GeomAPI.i */
@@@ -49,6 -50,7 +49,7 @@@
  %shared_ptr(GeomAlgoAPI_Revolution)
  %shared_ptr(GeomAlgoAPI_Rotation)
  %shared_ptr(GeomAlgoAPI_Sewing)
+ %shared_ptr(GeomAlgoAPI_SketchBuilder)
  %shared_ptr(GeomAlgoAPI_ShapeBuilder)
  %shared_ptr(GeomAlgoAPI_Translation)
  %shared_ptr(GeomAlgoAPI_Transform)
index 051c9266805fd9e87adc45ce3e61b48989999404,7be2b6eead7f2fc880581554e4ec5fa807fe860f..1f5dc4cfe6add343fde014c402defcb3d3bb6864
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "GeomAlgoAPI_Boolean.h"
@@@ -24,6 -25,8 +24,8 @@@
  
  #include <BOPAlgo_BOP.hxx>
  #include <TopTools_ListOfShape.hxx>
+ #include <TopoDS_Iterator.hxx>
+ #include <TopExp_Explorer.hxx>
  
  //=================================================================================================
  GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(const GeomShapePtr theObject,
@@@ -116,10 -119,11 +118,10 @@@ void GeomAlgoAPI_Boolean::build(const L
    if(aResult.ShapeType() == TopAbs_COMPOUND) {
      std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
      aGeomShape->setImpl(new TopoDS_Shape(aResult));
 -    ListOfShape aCompSolids, aFreeSolids;
 +    ListOfShape aResults;
      aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape,
                                                         GeomAPI_Shape::COMPSOLID,
 -                                                       aCompSolids,
 -                                                       aFreeSolids);
 +                                                       aResults);
      aResult = aGeomShape->impl<TopoDS_Shape>();
    }
  
    this->setShape(aShape);
    this->setDone(true);
  }
+ static bool isHistoryType(TopAbs_ShapeEnum theType) {
+   return theType == TopAbs_VERTEX || theType == TopAbs_EDGE ||
+          theType == TopAbs_FACE || theType == TopAbs_SOLID;
+ }
+ /// searches the corresponding result for theOld
+ static void searchResult(const TopoDS_Shape& theOld, const TopoDS_Shape& theResult,
+   BOPAlgo_BOP* theBuilder, TopTools_MapOfShape& theNews)
+ {
+   if (theResult.ShapeType() == theOld.ShapeType()) { // check some sub-shape produces a sub-result
+     if (theOld.IsSame(theResult)) {
+       theNews.Add(theResult);
+       return;
+     }
+     // searching for new result by sub-shapes of aSubType type
+     TopAbs_ShapeEnum aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1);
+     while(aSubType < TopAbs_VERTEX && !isHistoryType(aSubType))
+       aSubType = TopAbs_ShapeEnum(int(aSubType) + 1);
+     if (aSubType == TopAbs_SHAPE)
+       return;
+     TopTools_MapOfShape aResSubs;
+     for(TopExp_Explorer aResExp(theResult, aSubType); aResExp.More(); aResExp.Next())
+       aResSubs.Add(aResExp.Current());
+     for(TopExp_Explorer anExp(theOld, aSubType); anExp.More(); anExp.Next()) {
+       const TopTools_ListOfShape& aNewSubs = theBuilder->Modified(anExp.Current());
+       // searching for this new sub in theResult
+       for(TopTools_ListIteratorOfListOfShape aNewSub(aNewSubs); aNewSub.More(); aNewSub.Next()) {
+         if (aResSubs.Contains(aNewSub.Value())) {
+           theNews.Add(theResult);
+           return;
+         }
+       }
+     }
+   } else if (theResult.ShapeType() < theOld.ShapeType()) { // recursive search among sub-shapes
+     for(TopoDS_Iterator aSubResults(theResult); aSubResults.More(); aSubResults.Next()) {
+       searchResult(theOld, aSubResults.Value(), theBuilder, theNews);
+     }
+   }
+ }
+ // check the shape is on the higher level of compound or compsolid
+ bool isInComp(const TopoDS_Shape& theComp, const TopoDS_Shape& theShape) {
+   if (theComp.ShapeType() == TopAbs_COMPOUND || theComp.ShapeType() == TopAbs_COMPSOLID) {
+     for(TopoDS_Iterator anIter(theComp); anIter.More(); anIter.Next()) {
+       if (isInComp(anIter.Value(), theShape))
+         return true;
+     }
+   } else return theShape.IsSame(theComp);
+   return false;
+ }
+ //=================================================================================================
+ /// make arguments of Fuse produce result shapes with "modified" evolution
+ void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, ListOfShape& theNewShapes)
+ {
+   BOPAlgo_BOP* aBuilder = this->implPtr<BOPAlgo_BOP>();
+   if (aBuilder->Operation() == BOPAlgo_FUSE) { // only for fuse and when old is and argument
+     TopoDS_Shape anOld = theOldShape->impl<TopoDS_Shape>();
+     bool isOldComp = anOld.ShapeType() == TopAbs_COMPOUND || anOld.ShapeType() == TopAbs_COMPSOLID;
+     bool aFound = false;
+     TopTools_ListIteratorOfListOfShape anIter(aBuilder->Arguments());
+     for(; !aFound && anIter.More(); anIter.Next())
+       aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld));
+     for(anIter.Initialize(aBuilder->Tools()); !aFound && anIter.More(); anIter.Next())
+       aFound = anOld.IsSame(anIter.Value()) || (!isOldComp && isInComp(anIter.Value(), anOld));
+     if (aFound) {
+       TopoDS_Shape aResult = aBuilder->Shape();
+       TopTools_MapOfShape aNewsMap;
+       searchResult(anOld, aResult, aBuilder, aNewsMap);
+       if (!aNewsMap.IsEmpty()) {
+         for(TopTools_MapIteratorOfMapOfShape aNewsIter(aNewsMap); aNewsIter.More(); aNewsIter.Next())
+         {
+           GeomShapePtr aShape(new GeomAPI_Shape);
+           aShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewsIter.Value()));
+           theNewShapes.push_back(aShape);
+         }
+         return;
+       }
+     }
+   }
+   GeomAlgoAPI_MakeShape::modified(theOldShape, theNewShapes); // default behavior
+ }
index fc946cc187ad933ac92077cdea05be0407345771,e5367ec679b29a168b23f0f8b0dc6a6e811c14bb..d5a08376c3d3163fec204e9ca730396703e9788a
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef GeomAlgoAPI_Boolean_H_
@@@ -56,6 -57,10 +56,10 @@@ public
                                           const ListOfShape& theTools,
                                           const OperationType theOperationType);
  
+   /// Redefinition of the generic method for the Fuse problem: OCCT 30481
+   GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
+     ListOfShape& theNewShapes);
  private:
    /// Builds resulting shape.
    void build(const ListOfShape& theObjects,
index 2b1c8b12498d0384fdd9f8f89fbd708c096e7a4f,89549b88411a95e269a2d4615a727a4cfd87ccc7..c09e24f98020f7f8d6f12aabfabc8ff00c5127d6
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "GeomAlgoAPI_MakeVolume.h"
  
+ #include <GeomAPI_ShapeExplorer.h>
  #include <GeomAlgoAPI_ShapeTools.h>
  
  #include <BOPAlgo_MakerVolume.hxx>
@@@ -90,3 -93,32 +92,32 @@@ void GeomAlgoAPI_MakeVolume::build(cons
    this->setShape(aShape);
    this->setDone(true);
  }
+ //=================================================================================================
+ void GeomAlgoAPI_MakeVolume::modified(const GeomShapePtr theOldShape,
+                                       ListOfShape& theNewShapes)
+ {
+   if (theOldShape->shapeType() == GeomAPI_Shape::SOLID) {
+     ListOfShape aNewShapes;
+     // collect faces and parent shapes, if it is not done yet
+     if (!isNewShapesCollected(theOldShape, GeomAPI_Shape::FACE))
+       collectNewShapes(theOldShape, GeomAPI_Shape::FACE);
+     for (GeomAPI_ShapeExplorer anIt(shape(), GeomAPI_Shape::SOLID); anIt.more(); anIt.next()) {
+       for (GeomAPI_ShapeExplorer anExp(anIt.current(), GeomAPI_Shape::FACE);
+            anExp.more(); anExp.next()) {
+         GeomShapePtr anOldShapesCompound =
+             oldShapesForNew(theOldShape, anExp.current(), GeomAPI_Shape::FACE);
+         if (!anOldShapesCompound->isNull()) {
+           aNewShapes.push_back(anIt.current());
+           break;
+         }
+       }
+     }
+     if (!aNewShapes.empty())
+       theNewShapes = aNewShapes;
+   }
+   else
+     GeomAlgoAPI_MakeShape::modified(theOldShape, theNewShapes);
+ }
index f6af7a2f9b614e339b151ab821c076aca01566cb,ab11e510cb5e3677f03f1a4634cb542050c69fa0..c478d9808a003c739cd0e619612eb47b54f0eef4
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef GeomAlgoAPI_MakeVolume_H_
@@@ -43,6 -44,12 +43,12 @@@ public
    GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeVolume(const ListOfShape& theFaces,
      const bool theAvoidInternal);
  
+   /// \return the list of shapes modified from the shape \a theShape.
+   /// \param[in] theOldShape base shape.
+   /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared!
+   GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
+                                            ListOfShape& theNewShapes);
  private:
    /// Builds resulting shape.
    void build(const ListOfShape& theFaces);
index cbf2a75f5f8856b58e2fd01916cda7ae40e9b761,3510f87357a3482aab5a2e84868cbec84f5bfd3f..264c6bd30367566b8e8d401cf51d0cbaef9c7f38
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "GeomAlgoAPI_Sewing.h"
@@@ -79,6 -80,30 +79,30 @@@ void GeomAlgoAPI_Sewing::build(const Li
  }
  
  //==================================================================================================
+ #include <GeomAPI_ShapeExplorer.h>
+ #include <GeomAPI_ShapeIterator.h>
+ typedef std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator> MapFaceSolid;
+ static void facesBelongingToSolids(const GeomShapePtr& theShape,
+                                    MapFaceSolid& theShapeRelations)
+ {
+   for (GeomAPI_ShapeExplorer aSolidExp(theShape, GeomAPI_Shape::SHELL);
+        aSolidExp.more(); aSolidExp.next()) {
+     GeomShapePtr aSolid = aSolidExp.current();
+     for (GeomAPI_ShapeExplorer aFaceExp(aSolid, GeomAPI_Shape::FACE);
+          aFaceExp.more(); aFaceExp.next())
+       theShapeRelations[aFaceExp.current()].push_back(aSolid);
+   }
+ }
+ static bool isShapeInList(const GeomShapePtr& theShape, const ListOfShape& theList)
+ {
+   for (ListOfShape::const_iterator anIt = theList.begin(); anIt != theList.end(); ++anIt)
+     if (theShape->isEqual(*anIt))
+       return true;
+   return false;
+ }
  void GeomAlgoAPI_Sewing::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
                                    ListOfShape& theHistory)
  {
      aGeomShape->setImpl(new TopoDS_Shape(anExp.Current()));
      theHistory.push_back(aGeomShape);
    }
+   if (theShape->shapeType() < GeomAPI_Shape::FACE) {
+     ListOfShape aNewShapes;
+     // collect faces and parent shapes, if it is not done yet
+     if (!isNewShapesCollected(theShape, GeomAPI_Shape::FACE))
+       collectNewShapes(theShape, GeomAPI_Shape::FACE);
+     for (GeomAPI_ShapeIterator anIt(shape()); anIt.more(); anIt.next()) {
+       GeomShapePtr anOldShapesCompound =
+           oldShapesForNew(theShape, anIt.current(), GeomAPI_Shape::FACE);
+       if (!anOldShapesCompound->isNull())
+         aNewShapes.push_back(anIt.current());
+     }
+     if (!aNewShapes.empty())
+       theHistory = aNewShapes;
+   }
  }
index 810b2aaf56fde9c60472c5c9095a4c757717cad9,c562c562d4dc492b1778692dfddd5636b021b2af..4127ccf2cd7261b6acd0e892faac8f362ef7e0a1
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef GeomAlgoAPI_ShapeTools_H_
@@@ -51,7 -52,7 +51,7 @@@ public
    /// \return the total area of the faces of the current shape or 0.0 if it can be computed.
    GEOMALGOAPI_EXPORT static double area(const std::shared_ptr<GeomAPI_Shape> theShape);
  
-   /// \return the centre of mass of the current face.
+   /// \return the center of mass of the current face.
    /// The coordinates returned for the center of mass
    /// are expressed in the absolute Cartesian coordinate system.
    /// (This function works only for surfaces).
    /// \brief Combines faces with common edges to shells, or solids to compsolids.
    /// \param[in] theCompound compound of shapes.
    /// \param[in] theType type of combine.
 -  /// \param[out] theCombinedShapes resulting shapes.
 -  /// \param[out] theFreeShapes shapes that does not have common subshapes.
 +  /// \param[out] theResults resulting shapes.
    GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> combineShapes(
      const std::shared_ptr<GeomAPI_Shape> theCompound,
 -    const GeomAPI_Shape::ShapeType theType,
 -    ListOfShape& theCombinedShapes,
 -    ListOfShape& theFreeShapes);
 +    const GeomAPI_Shape::ShapeType theType, ListOfShape& theResults);
  
    /// \brief Groups shapes with shared topology to compounds.
    /// \param[in] theCompound compound of shapes.
@@@ -91,7 -95,7 +91,7 @@@
    /// \brief Enlarges or reduces plane to fit bounding box.
    /// \return plane that fits to bounding box.
    /// \param[in] thePlane base plane.
-   /// \param[in] thePoints bounding box points (shoud be eight).
+   /// \param[in] thePoints bounding box points (should be eight).
    GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Face> fitPlaneToBox(
      const std::shared_ptr<GeomAPI_Shape> thePlane,
      const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints);
  
    /// \brief Return a plane for list of shapes if they are all planar.
    /// \param[in] theShapes shapes to find plane.
-   /// \return plane where all shapes lie or empty ptr if they not planar.
+   /// \return plane where all shapes lie or empty pointer if they not planar.
    GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Pln> findPlane(const ListOfShape& theShapes);
  
-   /// \brief Checks that vertex/edge is inside face or vertext inside wire.
+   /// \brief Checks that vertex/edge is inside face or vertex inside wire.
    /// \param[in] theSubShape shape that should be inside.
    /// \param[in] theBaseShape base shape.
    /// \return true if edge inside the face.
                     std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D> >,
                               std::list<std::shared_ptr<ModelAPI_Object> > > > PointToRefsMap;
    /// \brief Performs the split of the shape by points.
-   /// \param[in] theBaseShape shape that should be splitted.
+   /// \param[in] theBaseShape shape that should be divided.
    /// \param[in] thePoints container of points to split
    /// \param[out] theShapes container of shapes after split
    GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
                                        std::set<std::shared_ptr<GeomAPI_Shape> >& theShapes);
  
    /// \brief Performs the split of the shape by points.
-   /// \param[in] theBaseShape shape that should be splitted.
+   /// \param[in] theBaseShape shape that should be divided.
    /// \param[in] thePoints container of points to split
    /// \param[out] theShapes container of shapes after split
    GEOMALGOAPI_EXPORT static void splitShape_p(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
                                      const std::set<std::shared_ptr<GeomAPI_Shape> >& theShapes);
  
  #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
-   /// \brief Returns a dir from a shape and an axis.
+   /// \brief Returns a direction from a shape and an axis.
    /// \param[in] theBaseShape shape whose center of mass serves as the starting point of the dir.
    /// \param[in] theAxis axis that serves as a direction for the dir
    /// \return dir that builds from center of mass of the base shape and the axis
                                      const std::shared_ptr<GeomAPI_Ax1> theAxis);
  #endif
  
-   /// \brief Reapproximate a wire to build a single edge
+   /// \brief Re-approximate a wire to build a single edge
    GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Edge> wireToEdge(
        const std::shared_ptr<GeomAPI_Wire>& theWire);
  
index fc8846c8b0a3d9638c1e848cc5bc011e7d002e97,90fbacd0e4ac050bb79fc8b90b002898bf4584fb..cd4db1dad6e388b6bc7fe89ee2b85f5f25909098
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <GeomAlgoAPI_SketchBuilder.h>
  #include <GeomAPI_PlanarEdges.h>
  
+ #include <GeomAPI_Pln.h>
  #include <BOPAlgo_Builder.hxx>
  #include <BRep_Builder.hxx>
  #include <BRepTools_WireExplorer.hxx>
@@@ -198,14 -201,15 +200,15 @@@ static void sortFaces(TopTools_ListOfSh
    }
  }
  
- void GeomAlgoAPI_SketchBuilder::createFaces(
+ void GeomAlgoAPI_SketchBuilder::build(
      const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
      const std::shared_ptr<GeomAPI_Dir>& theDirX,
      const std::shared_ptr<GeomAPI_Dir>& theNorm,
-     const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
-     std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
+     const std::list<std::shared_ptr<GeomAPI_Shape> >& theEdges)
  {
-   if (theFeatures.empty())
+   myResultFaces.clear();
+   setDone(false);
+   if (theEdges.empty())
      return;
  
    BRep_Builder aBuilder;
    aBuilder.MakeFace(aPlnFace, aPlane, Precision::Confusion());
  
    // Use General Fuse algorithm to prepare all subfaces, bounded by given list of edges
-   BOPAlgo_Builder aBB;
-   aBB.AddArgument(aPlnFace);
+   BOPAlgo_Builder* aBB = new BOPAlgo_Builder;
+   aBB->AddArgument(aPlnFace);
+   setImpl(aBB);
+   setBuilderType(OCCT_BOPAlgo_Builder);
  
    NCollection_List<TopoDS_Shape> anEdges;
    NCollection_List<TopoDS_Shape>::Iterator aShapeIt;
-   std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theFeatures.begin();
-   for (; aFeatIt != theFeatures.end(); aFeatIt++) {
+   std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theEdges.begin();
+   for (; aFeatIt != theEdges.end(); aFeatIt++) {
      std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
      const TopoDS_Edge& anEdge = aShape->impl<TopoDS_Edge>();
      if (anEdge.ShapeType() == TopAbs_EDGE)
-       aBB.AddArgument(anEdge);
+       aBB->AddArgument(anEdge);
    }
-   aBB.Perform();
-   if (aBB.HasErrors())
+   aBB->Perform();
+   if (aBB->HasErrors())
      return;
+   TopoDS_Compound aResult;
+   aBuilder.MakeCompound(aResult);
    // Collect faces
-   TopTools_ListOfShape anAreas = aBB.Modified(aPlnFace);
-   sortFaces(anAreas, theFeatures); // sort faces by the edges in them
+   TopTools_ListOfShape anAreas = aBB->Modified(aPlnFace);
+   sortFaces(anAreas, theEdges); // sort faces by the edges in them
    TopTools_ListIteratorOfListOfShape anIt(anAreas);
    for (; anIt.More(); anIt.Next()) {
      TopoDS_Face aFace = TopoDS::Face(anIt.Value());
  
        // to make faces equal on different platforms, we will find
        // a vertex lying on an edge with the lowest index in the list of initial edges
-       TopoDS_Vertex aStartVertex = findStartVertex(aWire, aFace, theFeatures);
+       TopoDS_Vertex aStartVertex = findStartVertex(aWire, aFace, theEdges);
  
        TopoDS_Wire aNewWire;
        aBuilder.MakeWire(aNewWire);
      }
  
      // store face
-     aFace = aNewFace;
+     aBuilder.Add(aResult, aNewFace);
      std::shared_ptr<GeomAPI_Shape> aResFace(new GeomAPI_Shape);
      aResFace->setImpl(new TopoDS_Face(aFace));
-     theResultFaces.push_back(aResFace);
+     myResultFaces.push_back(aResFace);
    }
+   // update results
+   GeomShapePtr aResShape(new GeomAPI_Shape);
+   aResShape->setImpl(new TopoDS_Shape(aResult));
+   setShape(aResShape);
+   setDone(true);
  }
  
- void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
-                                             const std::shared_ptr<GeomAPI_Dir>& theDirX,
-                                             const std::shared_ptr<GeomAPI_Dir>& theNorm,
-                                             const std::shared_ptr<GeomAPI_Shape>& theWire,
-                                 std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
+ GeomAlgoAPI_SketchBuilder::GeomAlgoAPI_SketchBuilder(
+   const std::shared_ptr<GeomAPI_Pln>& thePlane,
+   const std::list<std::shared_ptr<GeomAPI_Shape> >& theEdges)
+ {
+   build(thePlane->location(), thePlane->xDirection(), thePlane->direction(), theEdges);
+ }
+ GeomAlgoAPI_SketchBuilder::GeomAlgoAPI_SketchBuilder(
+     const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+     const std::shared_ptr<GeomAPI_Dir>& theDirX,
+     const std::shared_ptr<GeomAPI_Dir>& theNorm,
+     const std::shared_ptr<GeomAPI_Shape>& theWire)
  {
    std::shared_ptr<GeomAPI_PlanarEdges> aWire =
      std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
    if(aWire) {
      // Filter wires, return only faces.
-     createFaces(theOrigin, theDirX, theNorm, aWire->getEdges(), theResultFaces);
+     build(theOrigin, theDirX, theNorm, aWire->getEdges());
    } else { // it may be only one circle
      std::shared_ptr<GeomAPI_Edge> anEdge = std::dynamic_pointer_cast<GeomAPI_Edge>(theWire);
      if (anEdge) {
        std::list<std::shared_ptr<GeomAPI_Shape> > aList;
        aList.push_back(anEdge);
-       createFaces(theOrigin, theDirX, theNorm, aList, theResultFaces);
+       build(theOrigin, theDirX, theNorm, aList);
      }
    }
  }
index f7c1477ae6ac98c43fc9ffd9807d65655e1e7425,0c93379de6c09c5717a264e7d0050bfaafeafecd..fe29d89be27d1190411e5381b2c14907fb6f3e39
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef GeomAlgoAPI_SketchBuilder_H_
  #define GeomAlgoAPI_SketchBuilder_H_
  
  #include <GeomAlgoAPI.h>
+ #include <GeomAlgoAPI_MakeShape.h>
  
  #include <memory>
  #include <list>
  
- #include <GeomAPI_Dir.h>
- #include <GeomAPI_Pnt.h>
- #include <GeomAPI_Shape.h>
+ class GeomAPI_Dir;
+ class GeomAPI_Pln;
+ class GeomAPI_Pnt;
+ class GeomAPI_Shape;
  
  /** \class GeomAlgoAPI_SketchBuilder
   *  \ingroup DataAlgo
   *  \brief Creates planar faces based on the list of Sketch features
   */
- class GEOMALGOAPI_EXPORT GeomAlgoAPI_SketchBuilder
+ class GeomAlgoAPI_SketchBuilder : public GeomAlgoAPI_MakeShape
  {
-  public:
-   /** \brief Creates list of faces based on the features of the sketch
-    *  \param[in]  theOrigin      origin point of the sketch
-    *  \param[in]  theDirX        x-direction of the sketch
-    *  \param[in]  theNorm        normal of the sketch
-    *  \param[in]  theFeatures    initial features of the sketch
-    *  \param[out] theResultFaces faces based on closed wires
+ public:
+   /** \brief Creates list of faces based on the edges of the sketch
+    *  \param[in]  thePlane  plane of the sketch
+    *  \param[in]  theEdges  initial edges of the sketch
     *
     *  The algorithm searches all loops of edges surrounding lesser areas.
     */
-   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
-                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
-                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
-                           const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
-                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces);
+   GEOMALGOAPI_EXPORT
+   GeomAlgoAPI_SketchBuilder(const std::shared_ptr<GeomAPI_Pln>& thePlane,
+                             const std::list<std::shared_ptr<GeomAPI_Shape> >& theEdges);
  
    /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
     *  \param[in]  theOrigin      origin point of the sketch
     *  \param[in]  theDirX        x-direction of the sketch
     *  \param[in]  theNorm        normal of the sketch
     *  \param[in]  theWire        a wire which contains all edges
-    *  \param[out] theResultFaces faces based on closed wires
     *
     *  The algorithm searches all loops of edges surrounding lesser areas.
     */
-   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
-                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
-                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
-                           const std::shared_ptr<GeomAPI_Shape>& theWire,
-                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces);
+   GEOMALGOAPI_EXPORT
+   GeomAlgoAPI_SketchBuilder(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+                             const std::shared_ptr<GeomAPI_Dir>& theDirX,
+                             const std::shared_ptr<GeomAPI_Dir>& theNorm,
+                             const std::shared_ptr<GeomAPI_Shape>& theWire);
+   /// Return list of created faces
+   GEOMALGOAPI_EXPORT const std::list<std::shared_ptr<GeomAPI_Shape> >& faces() const
+   { return myResultFaces; }
+ private:
+   void build(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+              const std::shared_ptr<GeomAPI_Dir>& theDirX,
+              const std::shared_ptr<GeomAPI_Dir>& theNorm,
+              const std::list<std::shared_ptr<GeomAPI_Shape> >& theEdges);
+ private:
+   std::list<std::shared_ptr<GeomAPI_Shape> > myResultFaces;
  };
  
  #endif
index d087d0715af32adb3f10201ce0f8287c9ae216da,795a0fac19512a83a9fa9597b84b26200da83bfd..320c30d8fd31b8b7ab81c1093c22f938b416873a
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "GeomAlgoAPI_UnifySameDomain.h"
@@@ -47,18 -48,18 +47,18 @@@ void GeomAlgoAPI_UnifySameDomain::build
  
    // Make compound.
    GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(theShapes);
 -  ListOfShape aCombined, aFree;
 +  ListOfShape aResults;
    GeomAlgoAPI_ShapeTools::combineShapes(
      aCompound,
      GeomAPI_Shape::SHELL,
 -    aCombined,
 -    aFree);
 +    aResults);
  
 -  if(aFree.size() > 0 || aCombined.size() > 1) {
 +  if(aResults.size() > 1 ||
 +     (aResults.size() == 1 && aResults.front()->shapeType() > GeomAPI_Shape::SHELL)) {
      return;
    }
  
 -  const TopoDS_Shape& aShell = aCombined.front()->impl<TopoDS_Shape>();
 +  const TopoDS_Shape& aShell = aResults.front()->impl<TopoDS_Shape>();
  
    std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
    aShape->setImpl(new TopoDS_Shape(aShell));
@@@ -112,6 -113,8 +112,8 @@@ void GeomAlgoAPI_UnifySameDomain::modif
    const ShapeUpgrade_UnifySameDomain& aUnifyAlgo = this->impl<ShapeUpgrade_UnifySameDomain>();
  
    for (int aIsModified = 0; aIsModified <= 1; aIsModified++) {
+     if (!aUnifyAlgo.History()->IsSupportedType(aShape)) // to avoid crash in BRepTools_History
+       continue;
      const TopTools_ListOfShape& aMList = aIsModified ?
        aUnifyAlgo.History()->Modified(aShape) : aUnifyAlgo.History()->Generated(aShape);
      for (TopTools_ListIteratorOfListOfShape aModified(aMList); aModified.More(); aModified.Next()) {
index 053443ac730ee00d6b2636fa56f7a3f56c595c04,b57449f13d1667e3c65b74ae1a15f02c10c8c95b..92be8663dbc26432cf9469ff69e52055c14d0e7e
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "Model_AttributeSelection.h"
@@@ -1085,9 -1086,10 +1085,10 @@@ void Model_AttributeSelection::computeV
    if (aWasWholeContext) {
      theValShape = theOldContext->shape()->impl<TopoDS_Shape>();
    }
+   TopAbs_ShapeEnum aValType = theValShape.ShapeType();
    TopoDS_Shape aNewContShape = theNewContext->shape()->impl<TopoDS_Shape>();
    // if a new value is unchanged in the new context, do nothing: value is correct
-   TopExp_Explorer aSubExp(aNewContShape, theValShape.ShapeType());
+   TopExp_Explorer aSubExp(aNewContShape, aValType);
    for(; aSubExp.More(); aSubExp.Next()) {
      if (aSubExp.Current().IsSame(theValShape)) {
        theShapes.Append(theValShape);
                  return;
                }
                // don't add edges generated from faces
-               if (aPairIter.NewShape().ShapeType() <= theValShape.ShapeType())
+               if (aPairIter.NewShape().ShapeType() <= aValType)
                  theShapes.Append(aPairIter.NewShape());
              }
            } else if (!aPairIter.OldShape().IsNull()) { // search shape that contains this sub
-             TopExp_Explorer anExp(aPairIter.OldShape(), theValShape.ShapeType());
+             TopExp_Explorer anExp(aPairIter.OldShape(), aValType);
              for(; anExp.More(); anExp.Next()) {
                if (anExp.Current().IsSame(theValShape)) { // found a new container
-                 if (aPairIter.NewShape().IsNull()) {// value was removed
-                   theShapes.Clear();
-                   return;
-                 }
+                 if (aPairIter.NewShape().IsNull()) // skip removed high-level shape
+                   continue;
                  aNewToOld.Bind(aPairIter.NewShape(), aPairIter.OldShape());
                  anOlds.Add(aPairIter.OldShape());
                  break;
      }
    }
    if (aToFindPart == 2 && !aNewToOld.IsEmpty()) {
+     // also iterate the whole old shape to find not-modified shapes that contain this old
+     TopoDS_Shape anOldContShape = theOldContext->shape()->impl<TopoDS_Shape>();
+     NCollection_Map<TopAbs_ShapeEnum> aNewTypes; // types of shapes to iterate
+     TopTools_DataMapOfShapeShape::Iterator aNewTypeIter(aNewToOld);
+     for(; aNewTypeIter.More(); aNewTypeIter.Next()) {
+       if (aNewTypeIter.Key().ShapeType() != aValType)
+         aNewTypes.Add(aNewTypeIter.Key().ShapeType());
+     }
+     NCollection_Map<TopAbs_ShapeEnum>::Iterator aTypeIter(aNewTypes);
+     for(; aTypeIter.More(); aTypeIter.Next()) {
+       for(TopExp_Explorer anExp(anOldContShape, aTypeIter.Value()); anExp.More(); anExp.Next()) {
+         TopoDS_Shape anOld = anExp.Current();
+         if (aNewToOld.IsBound(anOld) || anOlds.Contains(anOld)) // this was modified
+           continue;
+         TopExp_Explorer aValExp(anOld, aValType);
+         for(; aValExp.More(); aValExp.Next()) {
+           const TopoDS_Shape& anUnchanged = aValExp.Current();
+           if (anUnchanged.IsSame(theValShape)) {
+             aNewToOld.Bind(anOld, anOld);
+             anOlds.Add(anOld);
+             break;
+           }
+         }
+       }
+     }
      // map of sub-shapes -> number of occurrences of these shapes in containers
      NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> aSubs;
      TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld);
      for(; aContIter.More(); aContIter.Next()) {
-       TopExp_Explorer aSubExp(aContIter.Key(), theValShape.ShapeType());
+       TopExp_Explorer aSubExp(aContIter.Key(), aValType);
        for(; aSubExp.More(); aSubExp.Next()) {
          if (!aSubs.IsBound(aSubExp.Current())) {
            aSubs.Bind(aSubExp.Current(), TopTools_MapOfShape());
        aSubsIter(aSubs);
      for(; aSubsIter.More(); aSubsIter.Next()) {
        if (aSubsIter.Value().Size() == aCountInOld) {
-         theShapes.Append(aSubsIter.Key());
+         TopoDS_Shape anOld = aSubsIter.Key();
+         // check this exists in the new shape
+         TopExp_Explorer aNew(aNewContShape, anOld.ShapeType());
+         for (; aNew.More(); aNew.Next()) {
+           if (aNew.Current().IsSame(anOld))
+             break;
+         }
+         if (aNew.More())
+           theShapes.Append(anOld);
        }
      }
    }
    if (theShapes.IsEmpty()) { // nothing was changed
-     theShapes.Append(aWasWholeContext ? TopoDS_Shape() : theValShape);
+     if (aWasWholeContext)
+       theShapes.Append(TopoDS_Shape());
+     else { // if theValShape exists in new context, add it without changes, otherwise - nothing
+       for (TopExp_Explorer aNew(aNewContShape, aValType); aNew.More(); aNew.Next()){
+         if (aNew.Current().IsSame(theValShape)) {
+           theShapes.Append(theValShape);
+           break;
+         }
+       }
+     }
+   } else if (theShapes.Size() > 1) {
+     // check it is possible to remove extra sub-shapes:
+     // keep only shapes with the same number of containers if possible
+     TopAbs_ShapeEnum anAncType = TopAbs_FACE;
+     if (aValType == TopAbs_VERTEX)
+       anAncType = TopAbs_EDGE;
+     TopoDS_Shape anOldContext = theOldContext->shape()->impl<TopoDS_Shape>();
+     TopTools_IndexedDataMapOfShapeListOfShape anOldMap;
+     TopExp::MapShapesAndUniqueAncestors(anOldContext, aValType,  anAncType, anOldMap);
+     if (anOldMap.Contains(theValShape)) {
+       int aNumInOld = anOldMap.FindFromKey(theValShape).Extent();
+       TopTools_IndexedDataMapOfShapeListOfShape aNewMap;
+       TopExp::MapShapesAndUniqueAncestors(aNewContShape, aValType,  anAncType, aNewMap);
+       TopTools_ListOfShape aNewResults;
+       for(TopTools_ListOfShape::Iterator aNewSubs(theShapes); aNewSubs.More(); aNewSubs.Next()) {
+         TopoDS_Shape aCand = aNewSubs.Value();
+         if (aNewMap.Contains(aCand) && aNewMap.FindFromKey(aCand).Extent() == aNumInOld)
+           aNewResults.Append(aCand);
+       }
+       if (!aNewResults.IsEmpty() && aNewResults.Size() < theShapes.Size())
+         theShapes = aNewResults;
+     }
    }
  }
  
@@@ -1188,7 -1253,6 +1252,6 @@@ bool Model_AttributeSelection::searchNe
    std::list<ResultPtr>& theResults, TopTools_ListOfShape& theValShapes)
  {
    std::set<ResultPtr> aResults; // to avoid duplicates, new context, null if deleted
-   TopTools_ListOfShape aResContShapes;
    // iterate context and shape, but also if it is sub-shape of main shape, check also it
    TopTools_ListOfShape aContextList;
    aContextList.Append(theContShape);
        aModifIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNewNS);
        if (aNewNS->Evolution() == TNaming_MODIFY || aNewNS->Evolution() == TNaming_GENERATED) {
          aResults.insert(aModifierObj);
-         aResContShapes.Append(aModifierObj->shape()->impl<TopoDS_Shape>());
        } else if (aNewNS->Evolution() == TNaming_DELETE) { // a shape was deleted => result is empty
          aResults.insert(ResultPtr());
        } else { // not-processed modification => don't support it
        }
      }
    }
-   if (aResults.empty())
+   // if there exist context composite and sub-result(s), leave only sub(s)
+   for(std::set<ResultPtr>::iterator aResIter = aResults.begin(); aResIter != aResults.end();) {
+     ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter);
+     for(; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent))
+       if (aResults.count(aParent))
+         break;
+     if (aParent.get()) { // erase from set, so, restart iteration
+       aResults.erase(aParent);
+       aResIter = aResults.begin();
+     } else aResIter++;
+   }
+   if (aResults.empty()) {
+     // check the context become concealed by operation which is earlier than this selection
+     std::list<ResultPtr> allRes;
+     ResultPtr aRoot = ModelAPI_Tools::bodyOwner(theContext, true);
+     if (!aRoot.get())
+       aRoot = theContext;
+     ResultBodyPtr aRootBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRoot);
+     if (aRootBody.get()) {
+       ModelAPI_Tools::allSubs(aRootBody, allRes);
+       allRes.push_back(aRootBody);
+     } else
+       allRes.push_back(aRoot);
+     FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
+     for (std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
+       ResultPtr aResCont = *aSub;
+       const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
+       std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
+       for (; aRef != aRefs.end(); aRef++) {
+         if (!aRef->get() || !(*aRef)->owner().get())
+           continue;
+         // concealed attribute only
+         FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
+         if (aRefFeat == aThisFeature)
+           continue;
+         if (!ModelAPI_Session::get()->validators()->isConcealed(
+           aRefFeat->getKind(), (*aRef)->id()))
+           continue;
+         if (theDoc->isLaterByDep(aThisFeature, aRefFeat)) {
+           // for extrusion cut in python script the nested sketch reference may be concealed before
+           // it is nested, so, check this composite feature is valid
+           static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
+           // need to be validated to update the "Apply" state if not previewed
+           if (aFactory->validate(aRefFeat))
+             return true; // feature conceals result, return true, so the context will be removed
+         }
+       }
+     }
      return false; // no modifications found, must stay the same
+   }
    // iterate all results to find further modifications
    std::set<ResultPtr>::iterator aResIter = aResults.begin();
    for(; aResIter != aResults.end(); aResIter++) {
    return true; // theResults must be empty: everything is deleted
  }
  
- void Model_AttributeSelection::updateInHistory()
+ void Model_AttributeSelection::updateInHistory(bool& theRemove)
  {
    ResultPtr aContext = std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
    // only bodies and parts may be modified later in the history, don't do anything otherwise
                continue;
  
              FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
 -            if (aRefFeat.get() && aRefFeat != owner()) {
 +            if (aRefFeat.get() && aRefFeat != owner() && aRefFeat->firstResult().get()) {
                FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
                if (!aDoc->isLaterByDep(aRefFeat, aThisFeature)) { // found better feature
                  aFoundNewContext = true;
    TopTools_ListOfShape aValShapes;
    if (searchNewContext(aDoc, aNewCShape, aContext, aValShape, aContLab, aNewContexts, aValShapes))
    {
+     std::set<ResultPtr> allContexts, aSkippedContext;
+     std::list<ResultPtr>::iterator aNewContext = aNewContexts.begin();
+     for(; aNewContext != aNewContexts.end(); aNewContext++)
+       allContexts.insert(*aNewContext);
+     // if there exist context composite and sub-result(s), leave only sub(s)
+     std::set<ResultPtr>::iterator aResIter = allContexts.begin();
+     for(; aResIter != allContexts.end(); aResIter++) {
+       ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter);
+       for(; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent))
+         if (allContexts.count(aParent))
+           aSkippedContext.insert(aParent);
+     }
      GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE;
      if (myParent) {
-       if (myParent->selectionType() == "VERTEX") aListShapeType = GeomAPI_Shape::VERTEX;
-       else if (myParent->selectionType() == "EDGE") aListShapeType = GeomAPI_Shape::EDGE;
-       else if (myParent->selectionType() == "FACE") aListShapeType = GeomAPI_Shape::FACE;
+       if (myParent->selectionType() == "VERTEX" || myParent->selectionType() == "Vertices")
+         aListShapeType = GeomAPI_Shape::VERTEX;
+       else if (myParent->selectionType() == "EDGE" || myParent->selectionType() == "Edges")
+         aListShapeType = GeomAPI_Shape::EDGE;
+       else if (myParent->selectionType() == "FACE" || myParent->selectionType() == "Faces")
+         aListShapeType = GeomAPI_Shape::FACE;
      }
  
      std::list<ResultPtr>::iterator aNewCont = aNewContexts.begin();
      TopTools_ListIteratorOfListOfShape aNewValues(aValShapes);
      bool aFirst = true; // first is set to this, next are appended to parent
      for(; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) {
+       if (aSkippedContext.count(*aNewCont))
+         continue;
  
        GeomShapePtr aValueShape;
        if (!aNewValues.Value().IsNull()) {
          continue;
        }
  
-       ResultPtr aSetContext;
        if (aFirst) {
          setValue(*aNewCont, aValueShape);
-         aSetContext = context();
+         aFirst = false;
        } else if (myParent) {
-         myParent->append(*aNewCont, aValueShape);
-         aSetContext = myParent->value(myParent->size() - 1)->context();
-       }
-       // #2826 : error if context is concealed by new context where the value is not presented
-       if (aSetContext.get()) {
-         bool anError = false;
-         std::list<ResultPtr> allRes;
-         ResultPtr aCompContext;
-         ResultBodyPtr aCompBody = ModelAPI_Tools::bodyOwner(aSetContext, true);
-         if (aCompBody.get()) {
-           ModelAPI_Tools::allSubs(aCompBody, allRes);
-           allRes.push_back(aCompBody);
-           aCompContext = aCompBody;
-         }
-         if (allRes.empty())
-           allRes.push_back(aSetContext);
-         std::list<ResultPtr>::iterator aSub = allRes.begin();
-         for (; !anError && aSub != allRes.end(); aSub++) {
-           ResultPtr aResCont = *aSub;
-           ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
-           const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
-           std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
-           for (; aRef != aRefs.end(); aRef++) {
-             if (!aRef->get() || !(*aRef)->owner().get())
-               continue;
-             // concealed attribute only
-             FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
-             if (!aRefFeat.get())
-               continue;
-             if (!ModelAPI_Session::get()->validators()->isConcealed(
-               aRefFeat->getKind(), (*aRef)->id()))
-               continue;
-             // check the found feature is older than this attribute
-             if (aRefFeat == aThisFeature || aDoc->isLaterByDep(aRefFeat, aThisFeature))
-               continue;
-             // check the found feature don't have the value-shape
-             GeomShapePtr aValue = aFirst ? value() : myParent->value(myParent->size() - 1)->value();
-             if (aValue.get()) {
-               std::list<ResultPtr>::const_iterator aRefResults = aRefFeat->results().cbegin();
-               for(; aRefResults != aRefFeat->results().cend(); aRefResults++) {
-                 if ((*aRefResults)->shape().get() &&
-                     !(*aRefResults)->shape()->isSubShape(aValue, false)) { // set error
-                   ResultPtr anEmptyContext;
-                   std::shared_ptr<GeomAPI_Shape> anEmptyShape;
-                   if (aFirst) {
-                     setValue(anEmptyContext, anEmptyShape); // nullify the selection
-                   } else {
-                     myParent->value(myParent->size() - 1)->setValue(anEmptyContext, anEmptyShape);
-                   }
-                   Events_InfoMessage("Model_AttributeSelection",
-                     "Selection of sub-shape of already modified result").send();
-                   anError = true;
-                   break;
-                 }
-               }
-               if (anError)
-                 break;
-             }
-           }
-         }
+         if (!myParent->isInList(*aNewCont, aValueShape)) // avoid addition of duplicates
+           myParent->append(*aNewCont, aValueShape);
        }
-       aFirst = false;
      }
      if (aFirst) { // nothing was added, all results were deleted
-       ResultPtr anEmptyContext;
-       std::shared_ptr<GeomAPI_Shape> anEmptyShape;
-       setValue(anEmptyContext, anEmptyShape); // nullify the selection
-       return;
+       if (myParent) {
+         theRemove = true;
+       } else {
+         ResultPtr anEmptyContext;
+         std::shared_ptr<GeomAPI_Shape> anEmptyShape;
+         setValue(anEmptyContext, anEmptyShape); // nullify the selection
+         return;
+       }
      }
    }
  }
index 25d852c695f92ca292c9f23e53a8162d0e9537ba,d240a31782b36124b4ff46435dbb264031e6dcf5..1896caa017f435687409907b388f0ac42a6c2d06
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef Model_AttributeSelection_H_
@@@ -121,7 -122,8 +121,8 @@@ public
  
    /// Updates the arguments of selection if something was affected by creation
    /// or reorder of features upper in the history line (issue #1757)
-   MODEL_EXPORT virtual void updateInHistory();
+   /// Returns theRemove true if this attribute must be removed (become deleted)
+   MODEL_EXPORT virtual void updateInHistory(bool& theRemove);
  
    // Implementation of the name generator method from the Selector package
    // This method returns the context name by the label of the sub-selected shape
index 7b2dfb6f8cd5abcc17c93fd5dca8ad46d702590c,733cb88bd9253f078b31d8e79c5d3e0ef29d20c5..2ab3b1cff4a3c553e434bb9d3fb2138a1358f9c6
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef MODEL_ATTRIBUTESTRING_H_
@@@ -40,16 -41,12 +40,16 @@@ class Model_AttributeString : public Mo
   public:
    /// Defines the std::string value
    MODEL_EXPORT virtual void setValue(const std::string& theValue);
 +  /// Defines the std::wstring value
 +  MODEL_EXPORT virtual void setValue(const std::wstring& theValue);
  
    /// Returns the std::string  value
    MODEL_EXPORT virtual std::string value();
 +  /// Returns the std::wstring  value
 +  MODEL_EXPORT virtual std::wstring valueW();
  
   protected:
-   /// Initializes attibutes
+   /// Initializes attributes
    Model_AttributeString(TDF_Label& theLabel);
    /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
    virtual void reinit();
index 913a773ada5efb0f960d9b934ebbe458f4193cc9,f65a38951923900400ca64ffec72af06c3f74070..5c89b7cc31fa069cdcfb89defed73961c4f32af1
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <Model_BodyBuilder.h>
@@@ -119,6 -120,53 +119,53 @@@ Model_BodyBuilder::Model_BodyBuilder(Mo
  {
  }
  
+ /// Checks that shape is presented in the tree with not-selection evolution
+ /// In theOriginalLabel it returns label where NS of old sub-shape is stored
+ static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAccess2,
+   TopoDS_Shape theShape, TDF_Label& theOriginalLabel)
+ {
+   bool aResult = TNaming_Tool::HasLabel(theAccess1, theShape);
+   if (aResult) { //check evolution and a label of this shape
+     for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next())
+     {
+       static Handle(TNaming_NamedShape) aNS;
+       if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+         if (aNS->Evolution() != TNaming_SELECTED) {
+           theOriginalLabel = aNS->Label();
+           return true;
+         }
+       }
+     }
+   }
+   if (!theAccess2.IsNull()) {
+     static const TDF_Label anEmpty;
+     return isShapeInTree(theAccess2, anEmpty, theShape, theOriginalLabel);
+   }
+   return false;
+ }
+ /// Stores entry to the external label in the entries list at this label
+ static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label theThis)
+ {
+   // store information about the external document reference to restore old shape on open
+   if (!theExternal.IsNull() && !theExternal.Root().IsEqual(theThis.Root())) {
+     Handle(TDataStd_ExtStringList) anEntries;
+     if (!theThis.FindAttribute(kEXTERNAL_SHAPE_REF, anEntries)) {
+       anEntries = TDataStd_ExtStringList::Set(theThis, kEXTERNAL_SHAPE_REF);
+     }
+     TCollection_AsciiString anEntry;
+     TDF_Tool::Entry(theExternal, anEntry);
+     // check it already contains this entry
+     TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
+     for(; anIter.More(); anIter.Next())
+       if (anIter.Value() == anEntry)
+         break;
+     if (!anIter.More()) {
+       anEntries->Append(anEntry);
+     }
+   }
+ }
  void Model_BodyBuilder::store(const GeomShapePtr& theShape,
                                const bool theIsStoreSameShapes)
  {
  }
  
  void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape,
-   const GeomShapePtr& theToShape)
+   const GeomShapePtr& theToShape, const bool theIsCleanStored)
  {
    std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
    if (aData) {
      TDF_Label aShapeLab = aData->shapeLab();
      // clean builders
-     clean();
-     // store the new shape as primitive
-     TNaming_Builder aBuilder(aShapeLab);
+     if (theIsCleanStored)
+       clean();
+     TNaming_Builder* aBuilder = builder(0);
      if (!theFromShape || !theToShape)
        return;  // bad shape
      TopoDS_Shape aShapeBasis = theFromShape->impl<TopoDS_Shape>();
      TopoDS_Shape aShapeNew = theToShape->impl<TopoDS_Shape>();
      if (aShapeNew.IsNull())
        return;  // null shape inside
-     aBuilder.Generated(aShapeBasis, aShapeNew);
+     // There is no sense to write history if old shape does not exist in the document.
+     TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+       ModelAPI_Session::get()->moduleDocument())->generalLabel();
+     TDF_Label anOriginalLabel;
+     if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeBasis, anOriginalLabel)) {
+       if (aBuilder->NamedShape()->Get().IsNull()) { // store as primitive if alone anyway
+         aBuilder->Generated(aShapeNew);
+       }
+     } else {
+       if (aBuilder->NamedShape()->Evolution() == TNaming_PRIMITIVE) { // erase primitive before
+         myBuilders.erase(0);
+         aBuilder = builder(0);
+       }
+       aBuilder->Generated(aShapeBasis, aShapeNew);
+       // store information about the external document reference to restore old shape on open
+       storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label());
+     }
      // register name
-     if(!aBuilder.NamedShape()->IsEmpty()) {
+     if(!aBuilder->NamedShape()->IsEmpty()) {
        Handle(TDataStd_Name) anAttr;
-       if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
+       if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
          std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
          if(!aName.empty()) {
            std::shared_ptr<Model_Document> aDoc =
              std::dynamic_pointer_cast<Model_Document>(document());
-           aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName);
+           aDoc->addNamingName(aBuilder->NamedShape()->Label(), aName);
          }
        }
      }
    }
  }
  
+ void Model_BodyBuilder::storeGenerated(const std::list<GeomShapePtr>& theFromShapes,
+   const GeomShapePtr& theToShape, const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+ {
+   bool aStored = false;
+   std::list<GeomShapePtr>::const_iterator anOldIter = theFromShapes.cbegin();
+   for (; anOldIter != theFromShapes.cend(); anOldIter++) {
+     bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || (*anOldIter)->isWire();
+     if (!aStore) {
+       ListOfShape aNews; // check this old really generates theToShape
+       theMakeShape->generated(*anOldIter, aNews);
+       ListOfShape::iterator aNewIter = aNews.begin();
+       for (; aNewIter != aNews.end(); aNewIter++) {
+         if (theToShape->isSame(*aNewIter))
+           break;
+       }
+       aStore = aNewIter != aNews.end();
+     }
+     if (aStore) {
+       storeGenerated(*anOldIter, theToShape, !aStored);
+       TNaming_Builder* aBuilder = builder(0);
+       aStored = !aBuilder->NamedShape()->IsEmpty();
+     }
+   }
+   if (!aStored) { // store as PRIMITIVE, but clean in any way
+     store(theToShape);
+     return;
+   }
+ }
  TNaming_Builder* Model_BodyBuilder::builder(const int theTag)
  {
    std::map<int, TNaming_Builder*>::iterator aFind = myBuilders.find(theTag);
@@@ -218,7 -314,6 +313,6 @@@ void Model_BodyBuilder::storeModified(c
    if (aData) {
      // clean builders
      if (theIsCleanStored) clean();
-     // store the new shape as primitive
      TNaming_Builder* aBuilder = builder(0);
      if (!theOldShape || !theNewShape)
        return;  // bad shape
      TopoDS_Shape aShapeNew = theNewShape->impl<TopoDS_Shape>();
      if (aShapeNew.IsNull())
        return;  // null shape inside
-     aBuilder->Modify(aShapeOld, aShapeNew);
+     // There is no sense to write history if old shape does not exist in the document.
+     TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+       ModelAPI_Session::get()->moduleDocument())->generalLabel();
+     TDF_Label anOriginalLabel;
+     if (!isShapeInTree(aData->shapeLab(), anAccess2, aShapeOld, anOriginalLabel)) {
+       if (aBuilder->NamedShape()->Get().IsNull()) { // store as primitive if alone anyway
+         aBuilder->Generated(aShapeNew);
+       }
+     } else {
+       if (aBuilder->NamedShape()->Evolution() == TNaming_PRIMITIVE) { // erase primitive before
+         myBuilders.erase(0);
+         aBuilder = builder(0);
+       }
+       aBuilder->Modify(aShapeOld, aShapeNew);
+       // store information about the external document reference to restore old shape on open
+       storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label());
+     }
      if(!aBuilder->NamedShape()->IsEmpty()) {
        Handle(TDataStd_Name) anAttr;
-       if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
+       if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) {
          std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
          if(!aName.empty()) {
            std::shared_ptr<Model_Document> aDoc =
    }
  }
  
+ void Model_BodyBuilder::storeModified(const std::list<GeomShapePtr>& theOldShapes,
+   const GeomShapePtr& theNewShape, const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+ {
+   bool aStored = false;
+   std::list<GeomShapePtr>::const_iterator anOldIter = theOldShapes.cbegin();
+   for(; anOldIter != theOldShapes.cend(); anOldIter++) {
+     // compounds may cause crash if call "modified"
+     bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || (*anOldIter)->isWire();
+     if (!aStore) {
+       ListOfShape aNews; // check this old really modifies theNewShape
+       theMakeShape->modified(*anOldIter, aNews);
+       ListOfShape::iterator aNewIter = aNews.begin();
+       for(; aNewIter != aNews.end(); aNewIter++) {
+         if (theNewShape->isSame(*aNewIter))
+           break;
+       }
+       aStore = aNewIter != aNews.end();
+     }
+     if (aStore) {
+       storeModified(*anOldIter, theNewShape, !aStored);
+       TNaming_Builder* aBuilder = builder(0);
+       aStored = !aBuilder->NamedShape()->IsEmpty();
+     }
+   }
+   if (!aStored) { // store as PRIMITIVE, but clean in any way
+     store(theNewShape);
+     return;
+   }
+ }
  void Model_BodyBuilder::clean()
  {
    TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>(data())->shapeLab();
@@@ -430,53 -574,6 +573,6 @@@ static void keepTopLevelShapes(ListOfSh
    }
  }
  
- /// Checks that shape is presented in the tree with not-selection evolution
- /// In theOriginalLabel it returns label where NS of old sub-shape is stored
- static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAccess2,
-   TopoDS_Shape theShape, TDF_Label& theOriginalLabel)
- {
-   bool aResult = TNaming_Tool::HasLabel(theAccess1, theShape);
-   if (aResult) { //check evolution and a label of this shape
-     for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next())
-     {
-       static Handle(TNaming_NamedShape) aNS;
-       if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
-         if (aNS->Evolution() != TNaming_SELECTED) {
-           theOriginalLabel = aNS->Label();
-           return true;
-         }
-       }
-     }
-   }
-   if (!theAccess2.IsNull()) {
-     static const TDF_Label anEmpty;
-     return isShapeInTree(theAccess2, anEmpty, theShape, theOriginalLabel);
-   }
-   return false;
- }
- /// Stores entry to the external label in the entries list at this label
- static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label theThis)
- {
-   // store information about the external document reference to restore old shape on open
-   if (!theExternal.IsNull() && !theExternal.Root().IsEqual(theThis.Root())) {
-     Handle(TDataStd_ExtStringList) anEntries;
-     if (!theThis.FindAttribute(kEXTERNAL_SHAPE_REF, anEntries)) {
-       anEntries = TDataStd_ExtStringList::Set(theThis, kEXTERNAL_SHAPE_REF);
-     }
-     TCollection_AsciiString anEntry;
-     TDF_Tool::Entry(theExternal, anEntry);
-     // check it already contains this entry
-     TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
-     for(; anIter.More(); anIter.Next())
-       if (anIter.Value() == anEntry)
-         break;
-     if (!anIter.More()) {
-       anEntries->Append(anEntry);
-     }
-   }
- }
  void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
                                             const GeomShapePtr& theOldShape,
                                             const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
  
        bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
        bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false);
-       if (aNewShapeIsSameAsOldShape
-           || aNewShapeIsNotInResultShape)
-       {
+       if (aNewShapeIsSameAsOldShape || aNewShapeIsNotInResultShape)
          continue;
-       }
  
-       TNaming_Builder* aBuilder;
-       if (aResultShape->isSame(aNewShape)) {
-         // keep the modification evolution on the root level (2241 - history propagation issue)
-         aBuilder = builder(0);
-         TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
-         Handle(TDF_Reference) aRef;
-         if (aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
-           // Store only in case if it does not have reference.
-           continue;
-         }
+       if (aResultShape->isSame(aNewShape))
+         continue; // it is stored on the root level (2241 - history propagation issue)
  
-         // Check if new shape was already stored.
-         if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
-         if (!aBuilder->NamedShape().IsNull() &&
-             ((isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_GENERATED)
-               || (!isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_MODIFY)))
-         {
-           myBuilders.erase(0); // clear old builder to avoid different evolutions crash
-           aBuilder = builder(0);
-         }
-       } else {
-         int aTag = isGenerated ? getGenerationTag(aNewShape_)
-                                : getModificationTag(aNewShape_);
-         aBuilder = builder(aTag);
-         // Check if new shape was already stored.
-         if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
-         buildName(aTag, theName);
-       }
+       int aTag = isGenerated ? getGenerationTag(aNewShape_) : getModificationTag(aNewShape_);
+       TNaming_Builder*aBuilder = builder(aTag);
+       if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_))
+         continue; // new shape was already stored.
  
+       buildName(aTag, theName);
        isGenerated ? aBuilder->Generated(anOldSubShape_, aNewShape_)
                    : aBuilder->Modify(anOldSubShape_, aNewShape_);
        // store information about the external document reference to restore old shape on open
  void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
                                              const GeomShapePtr& theOldShape,
                                              const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                             const std::string& theName)
+                                             const std::string& theName,
+                                             const bool theSaveOldIfNotInTree)
  {
    GeomShapePtr aResultShape = shape();
    TopTools_MapOfShape anAlreadyProcessedShapes;
      bool anOldSubShapeNotInTree =
        !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel);
      if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) {
-       continue;
+       if (theSaveOldIfNotInTree) {
+         std::string aSelectionName = theName + "Selected";
+         generated(anOldSubShape, aSelectionName, false);
+       } else
+         continue;
      }
  
      // Get new shapes.
          continue;
        }
  
+       if (aResultShape->isSame(aNewShape))
+         continue; // it is stored on the root level
        TopAbs_ShapeEnum aNewShapeType = aNewShape_.ShapeType();
        if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) {
          // TODO: This is a workaround. New shape should be only edge or face.
            storeExternalReference(anOriginalLabel, builder(aTag)->NamedShape()->Label());
          }
          buildName(aTag, theName);
-       } if (aResultShape->isSame(aNewShape)) {
-         // keep the generation evolution on the root level (2397 - for intersection feature)
-         TNaming_Builder* aBuilder = builder(0);
-         TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
-         Handle(TDF_Reference) aRef;
-         if (aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
-           // Store only in case if it does not have reference.
-           continue;
-         }
-         // Check if new shape was already stored.
-         if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
-         if (!aBuilder->NamedShape().IsNull() &&
-             aBuilder->NamedShape()->Evolution() != TNaming_GENERATED) {
-           myBuilders.erase(0); // clear old builder to avoid different evolutions crash
-           aBuilder = builder(0);
-         }
-         aBuilder->Generated(anOldSubShape_, aNewShape_);
        } else {
          int aTag = getGenerationTag(aNewShape_);
          if (aTag == INVALID_TAG) return;
index 3819141009aecadbb48339a7dbbe207f72e560f6,13c91151769df68aa486495c89cf270ee6c37c27..08e79790b890d04982205f1cb2d3e92525954744
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef Model_BodyBuilder_H_
@@@ -41,21 -42,34 +41,34 @@@ class Model_BodyBuilder : public ModelA
  public:
    /// Stores the shape (called by the execution method).
    MODEL_EXPORT virtual void store(const GeomShapePtr& theShape,
-                                   const bool theIsStoreSameShapes = true);
+                                   const bool theIsStoreSameShapes = true) override;
  
    /// Stores the generated shape (called by the execution method).
    MODEL_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
-                                            const GeomShapePtr& theToShape);
+                                            const GeomShapePtr& theToShape,
+                                            const bool theIsCleanStored = true) override;
+   /// Stores the root generated shapes (called by the execution method).
+   MODEL_EXPORT virtual void storeGenerated(const std::list<GeomShapePtr>& theFromShapes,
+     const GeomShapePtr& theToShape,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
  
    /// Stores the modified shape (called by the execution method).
    /// \param theOldShape shape that produces result
    /// \param theNewShape resulting shape
-   /// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
-   ///          theNewShape is compound of solids, if zero it is not used
+   /// \param theIsCleanStored erases all previous data structure of this body if true
    MODEL_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
                                            const GeomShapePtr& theNewShape,
                                            const bool theIsCleanStored = true) override;
  
+   /// Stores the root modified shape (called by the execution method).
+   /// \param theOldShapes all shapes that produce result
+   /// \param theNewShape resulting shape
+   /// \param theIsCleanStored erases all previous data structure of this body if true
+   MODEL_EXPORT virtual void storeModified(const std::list<GeomShapePtr>& theOldShapes,
+     const GeomShapePtr& theNewShape,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
    /// Returns the shape-result produced by this feature
    MODEL_EXPORT virtual GeomShapePtr shape();
  
    virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
                                     const GeomShapePtr& theOldShape,
                                     const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                    const std::string& theName = "") override;
+                                    const std::string& theName = "",
+                                    const bool theSaveOldIfNotInTree = false) override;
  
    /// Loads shapes of the first level (to be used during shape import)
    MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
index 7f1659411d0b1c4a8460e896ab42d0a65ad122ae,3a7c77452580f323a8de735abc2243d1a53e4874..4f442842e795195bbbd0763b7e8d3c2986ae9523
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <Model_ResultBody.h>
  #include <ModelAPI_Tools.h>
  #include <Model_Data.h>
  #include <Events_Loop.h>
+ #include <GeomAPI_ShapeIterator.h>
+ #include <GeomAPI_ShapeExplorer.h>
  
  #include <TopoDS_Shape.hxx>
  #include <TopExp_Explorer.hxx>
+ #include <TopTools_MapOfShape.hxx>
  #include <TDataStd_UAttribute.hxx>
  
  // if this attribute exists, the shape is connected topology
@@@ -74,7 -78,8 +77,8 @@@ bool Model_ResultBody::generated(const 
  void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
                                             const GeomShapePtr& theOldShape,
                                             const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                            const std::string& theName)
+                                            const std::string& theName,
+                                            const bool theSaveOldIfNotInTree)
  {
    if (mySubs.size()) { // consists of subs
      for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
           ++aSubIter)
      {
        const ResultBodyPtr& aSub = *aSubIter;
-       aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+       aSub->loadGeneratedShapes(
+         theAlgo, theOldShape, theShapeTypeToExplore, theName, theSaveOldIfNotInTree);
      }
    } else { // do for this directly
-     myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+     myBuilder->loadGeneratedShapes(
+       theAlgo, theOldShape, theShapeTypeToExplore, theName, theSaveOldIfNotInTree);
    }
  }
  
@@@ -94,31 -101,12 +100,12 @@@ void Model_ResultBody::loadModifiedShap
                                            const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
                                            const std::string& theName)
  {
-   if (/*theSplitInSubs &&*/ mySubs.size()) { // consists of subs
+   if (mySubs.size()) { // consists of subs
      // optimization of getting of new shapes for specific sub-result
      if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore))
        theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore);
      std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
      for(; aSubIter != mySubs.cend(); aSubIter++) {
-       // check that sub-shape was also created as modification of ShapeIn
-       /* to find when it is needed later to enable: to store modification of sub-bodies not only as primitives
-       GeomShapePtr aSubGeomShape = (*aSubIter)->shape();
-       if (!theIsStoreAsGenerated && aSubGeomShape.get() && !aSubGeomShape->isNull()) {
-         TopoDS_Shape aSubShape = aSubGeomShape->impl<TopoDS_Shape>();
-         TopoDS_Shape aWholeIn = theShapeIn->impl<TopoDS_Shape>();
-         for(TopExp_Explorer anExp(aWholeIn, aSubShape.ShapeType()); anExp.More(); anExp.Next()) {
-           ListOfShape aHistory;
-           std::shared_ptr<GeomAPI_Shape> aSubIn(new GeomAPI_Shape());
-           aSubIn->setImpl((new TopoDS_Shape(anExp.Current())));
-           theMS->modified(aSubIn, aHistory);
-           std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aHistory.begin();
-           for (; anIt != aHistory.end(); anIt++) {
-             if ((*anIt)->isSame(aSubGeomShape)) {
-               (*aSubIter)->storeModified(aSubIn, aSubGeomShape, -2); // -2 is to avoid clearing
-             }
-           }
-         }
-       }*/
        (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
      }
    } else { // do for this directly
@@@ -272,7 -260,14 +259,14 @@@ void Model_ResultBody::updateSubs(cons
        }
        GeomShapePtr anOldSubShape = aSub->shape();
        if (!aShape->isEqual(anOldSubShape)) {
-         aSub->store(aShape, false);
+         if (myAlgo.get()) {
+           std::list<GeomShapePtr> anOldForSub;
+           computeOldForSub(aShape, myOlds, anOldForSub);
+           myIsGenerated ? aSub->storeGenerated(anOldForSub, aShape, myAlgo) :
+             aSub->storeModified(anOldForSub, aShape, myAlgo);
+         } else {
+           aSub->store(aShape, false);
+         }
          aECreator->sendUpdated(aSub, EVENT_DISP);
          aECreator->sendUpdated(aSub, EVENT_UPD);
        }
    }
  }
  
+ void Model_ResultBody::updateSubs(
+   const GeomShapePtr& theThisShape, const std::list<GeomShapePtr>& theOlds,
+   const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape, const bool isGenerated)
+ {
+   myAlgo = theMakeShape;
+   myOlds = theOlds;
+   myIsGenerated = isGenerated;
+   // to avoid changing of "isDisabled" flag in the "updateSubs" cycle
+   isDisabled();
+   updateSubs(theThisShape, true);
+   myAlgo.reset();
+   myOlds.clear();
+   myHistoryCash.Clear();
+ }
  bool Model_ResultBody::isConnectedTopology()
  {
    TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
@@@ -338,3 -350,88 +349,88 @@@ void Model_ResultBody::cleanCash(
      aSub->cleanCash();
    }
  }
+ // adds to the theSubSubs map all sub-shapes of theSub if it is compound of compsolid
+ static void collectSubs(
+   const GeomShapePtr theSub, TopTools_MapOfShape& theSubSubs, const bool theOneLevelMore)
+ {
+   if (theSub->isNull())
+     return;
+   if (theSubSubs.Add(theSub->impl<TopoDS_Shape>()))  {
+     bool aIsComp = theSub->isCompound() || theSub->isCompSolid();
+     if (aIsComp) {
+       for(GeomAPI_ShapeIterator anIter(theSub); anIter.more(); anIter.next())
+         collectSubs(anIter.current(), theSubSubs, theOneLevelMore);
+     } else if (theOneLevelMore) {
+       GeomAPI_Shape::ShapeType aSubType = GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1);
+       if (aSubType == GeomAPI_Shape::SHAPE)
+         return;
+       if (aSubType == GeomAPI_Shape::SHELL)
+         aSubType = GeomAPI_Shape::FACE;
+       if (aSubType == GeomAPI_Shape::WIRE)
+         aSubType = GeomAPI_Shape::EDGE;
+       for(GeomAPI_ShapeExplorer anExp(theSub, aSubType); anExp.more(); anExp.next()) {
+         collectSubs(anExp.current(), theSubSubs, false);
+       }
+     }
+   }
+ }
+ void Model_ResultBody::computeOldForSub(const GeomShapePtr& theSub,
+   const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub)
+ {
+   // the old can be also used for sub-shape of theSub; collect all subs of compound or compsolid
+   TopTools_MapOfShape aSubSubs;
+   collectSubs(theSub, aSubSubs, false);
+   std::list<GeomShapePtr>::const_iterator aRootOlds = theAllOlds.cbegin();
+   for (; aRootOlds != theAllOlds.cend(); aRootOlds++) {
+     // use sub-shapes of olds too if they are compounds or compsolids
+     TopTools_MapOfShape anOldSubs;
+     // iterate one level more (for intersection of solids this is face)
+     collectSubs(*aRootOlds, anOldSubs, true);
+     for (TopTools_MapOfShape::Iterator anOldIter(anOldSubs); anOldIter.More(); anOldIter.Next()) {
+       TopoDS_Shape anOldShape = anOldIter.Value();
+       if (anOldShape.ShapeType() == TopAbs_COMPOUND || anOldShape.ShapeType() == TopAbs_SHELL ||
+           anOldShape.ShapeType() == TopAbs_WIRE)
+         continue; // container old-shapes are not supported by the history, may cause crash
+       GeomShapePtr anOldSub(new GeomAPI_Shape);
+       anOldSub->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOldShape));
+       ListOfShape aNews;
+       if (myHistoryCash.IsBound(anOldShape)) {
+         const TopTools_ListOfShape& aList = myHistoryCash.Find(anOldShape);
+         for(TopTools_ListIteratorOfListOfShape anIter(aList); anIter.More(); anIter.Next()) {
+           GeomShapePtr aShape(new GeomAPI_Shape);
+           aShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anIter.Value()));
+           aNews.push_back(aShape);
+         }
+       } else {
+         myIsGenerated ? myAlgo->generated(anOldSub, aNews) : myAlgo->modified(anOldSub, aNews);
+         // MakeShape may return alone old shape if there is no history information for this input
+         if (aNews.size() == 1 && aNews.front()->isEqual(anOldSub))
+           aNews.clear();
+         // store result in the history
+         TopTools_ListOfShape aList;
+         for (ListOfShape::iterator aNewIter = aNews.begin(); aNewIter != aNews.end(); aNewIter++) {
+           aList.Append((*aNewIter)->impl<TopoDS_Shape>());
+         }
+         myHistoryCash.Bind(anOldShape, aList);
+       }
+       for (ListOfShape::iterator aNewIter = aNews.begin(); aNewIter != aNews.end(); aNewIter++) {
+         if (aSubSubs.Contains((*aNewIter)->impl<TopoDS_Shape>())) {
+           // check list already contains this sub
+           std::list<GeomShapePtr>::iterator aResIter = theOldForSub.begin();
+           for(; aResIter != theOldForSub.end(); aResIter++)
+             if ((*aResIter)->isSame(anOldSub))
+               break;
+           if (aResIter == theOldForSub.end())
+             theOldForSub.push_back(anOldSub); // found old used for new theSubShape creation
+           break;
+         }
+       }
+     }
+   }
+ }
index 19a3bb9874bc696eb113590d961a75e985deac33,68ae62c3b4af8a5f36e936f4a5755380e40dba20..8abd4408965588dccb07a882fdb07258f53156ca
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef Model_ResultBody_H_
@@@ -25,6 -26,8 +25,8 @@@
  #include <vector>
  #include <map>
  
+ #include <TopTools_DataMapOfShapeListOfShape.hxx>
  /**\class Model_ResultBody
  * \ingroup DataModel
  * \brief The body (shape) result of a feature.
@@@ -42,6 -45,14 +44,14 @@@ class Model_ResultBody : public ModelAP
    std::map<ObjectPtr, int> mySubsMap;
    /// Keeps the last state of the concealment flag in order to update it when needed.
    bool myLastConcealed;
+   /// History information for update subs
+   std::shared_ptr<GeomAlgoAPI_MakeShape> myAlgo;
+   /// All old shapes used for the root result construction
+   std::list<GeomShapePtr> myOlds;
+   /// Information about the kind of the history information: modified or generated
+   bool myIsGenerated;
+   /// Map from old shape to list of new shapes, cash for computeOldForSub method
+   TopTools_DataMapOfShapeListOfShape myHistoryCash;
  
  public:
  
@@@ -58,7 -69,8 +68,8 @@@
    virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
                                     const GeomShapePtr& theOldShape,
                                     const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                    const std::string& theName = "") override;
+                                    const std::string& theName = "",
+                                    const bool theSaveOldIfNotInTree = false) override;
  
    /// load modified shapes for sub-objects
    MODEL_EXPORT
@@@ -108,9 -120,18 +119,18 @@@ protected
    void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
                    const bool theShapeChanged = true);
  
+   /// Updates the sub-bodies in accordance to the algorithm history information
+   void updateSubs(
+     const GeomShapePtr& theThisShape, const std::list<GeomShapePtr>& theOlds,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape, const bool isGenerated);
    // Checks the state of children and parents to send events of creation/erase when needed
    void updateConcealment();
  
+   /// Adds to theOldForSub only old shapes that where used for theSub creation
+   void computeOldForSub(const GeomShapePtr& theSub,
+     const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub);
    friend class Model_Objects;
  };
  
index c2c425cdcb9c28c09b6f66811fe14ae6f848aa12,8765caeb0daf9fca4bb5d7c230185a27bb78cd4b..041e8f226d34a769e6e4ccf23110d04d99a55ace
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <Model_ResultConstruction.h>
@@@ -291,12 -292,12 +291,12 @@@ void Model_ResultConstruction::storeSha
          }
        }
  
-       std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
-       GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
-         aWirePtr->norm(), aWirePtr, aFaces);
+       GeomAlgoAPI_SketchBuilder aSketchBuilder(aWirePtr->origin(), aWirePtr->dirX(),
+                                                aWirePtr->norm(), aWirePtr);
+       const ListOfShape& aFaces = aSketchBuilder.faces();
        // order is important to store faces in the same order if sketch is created from scratch
        NCollection_IndexedDataMap<TopoDS_Face, TColStd_ListOfInteger> aNewIndices; // edges indices
-       std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
+       std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aFIter = aFaces.begin();
        for (; aFIter != aFaces.end(); aFIter++) {
          std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
          // put them to a label, trying to keep the same faces on the same labels
                aNotFound += 1.;
              }
            }
 -          if (aNotFound < aBestNotFound) {
 +          if (aNotFound <= aBestNotFound) { // less and equal to find better "found": #2859
              if (aFound > aBestFound) {
                aBestNotFound = aNotFound;
                aBestFound = aFound;
index 98d13b066b410deb6d813c01e22827520efa7214,8356838450635e191e224a07d91c3240c6535660..f86c3076b240ecde193a2eb4955552fbbed23100
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include <Model_Update.h>
@@@ -300,19 -301,16 +300,19 @@@ void Model_Update::processEvent(const s
          std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
      const std::set<ObjectPtr>& anObjs = aMsg->objects();
      std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
 +    std::list<ObjectPtr> aFeatures, aResults;
      for(; anObjIter != anObjs.cend(); anObjIter++) {
        if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())->executeFeatures()) {
          if ((*anObjIter)->groupName() == ModelAPI_Feature::group()) {
            // results creation means enabling, not update
 -          ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent);
 +          aFeatures.push_back(*anObjIter);
          } else {
 -          ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kRedisplayEvent);
 +          aResults.push_back(*anObjIter);
          }
        }
      }
 +    ModelAPI_EventCreator::get()->sendUpdated(aFeatures, kUpdatedEvent);
 +    ModelAPI_EventCreator::get()->sendUpdated(aResults, kRedisplayEvent);
      return;
    }
    if (theMessage->eventID() == kUpdatedEvent) {
@@@ -914,7 -912,7 +914,7 @@@ void Model_Update::updateArguments(Feat
        if (aSelAttr) {
          ObjectPtr aContext = aSelAttr->context();
          // update argument only if the referenced object is ready to use
 -        if (aContext.get() && !aContext->isDisabled() && !aSelAttr->isInvalid()) {
 +        if (aContext.get() && !aContext->isDisabled()) {
            if (isReason(theFeature, aContext)) {
              if (!aSelAttr->update()) {
                bool isObligatory = !aFactory->isNotObligatory(
                  aState = ModelAPI_StateInvalidArgument;
              }
            }
 -        } else if (aContext.get() || aSelAttr->isInvalid()) {
 +        } else if (aContext.get()) {
            // here it may be not obligatory, but if the reference is wrong, it should not be correct
            bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
            if (isObligatory)
@@@ -1068,19 -1066,27 +1068,27 @@@ void Model_Update::updateSelection(cons
      for (; aRefsIter != aRefs.end(); aRefsIter++) {
        std::shared_ptr<Model_AttributeSelection> aSel =
          std::dynamic_pointer_cast<Model_AttributeSelection>(*aRefsIter);
-       aSel->updateInHistory();
+       bool aRemove = false;
+       aSel->updateInHistory(aRemove);
      }
      // update the selection list attributes if any
      aRefs = (*anObj)->data()->attributes(ModelAPI_AttributeSelectionList::typeId());
      for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
+       std::set<int> aRemoveSet;
        std::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
          std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
        for(int a = aSel->size() - 1; a >= 0; a--) {
          std::shared_ptr<Model_AttributeSelection> aSelAttr =
            std::dynamic_pointer_cast<Model_AttributeSelection>(aSel->value(a));
-         if (aSelAttr.get())
-           aSelAttr->updateInHistory();
+         if (aSelAttr.get()) {
+           bool theRemove = false;
+           aSelAttr->updateInHistory(theRemove);
+           if (theRemove) {
+             aRemoveSet.insert(a);
+           }
+         }
        }
+       aSel->remove(aRemoveSet);
      }
    }
  }
index 3cbdf43e0ddbfc158d2f09ddf52fadf5bc888742,10803b8c77815768d543db5384ada017412c7cfe..ecf3137338df10ba16e832437dc7af0c6aad6a9c
mode 100644,100755..100644
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef ModelAPI_BodyBuilder_H_
@@@ -46,13 -47,22 +46,22 @@@ public
  
    /// Stores the generated shape (called by the execution method).
    virtual void storeGenerated(const GeomShapePtr& theFromShape,
-                               const GeomShapePtr& theToShape) = 0;
+                               const GeomShapePtr& theToShape,
+                               const bool theIsCleanStored = true) = 0;
+   /// Stores the root generated shapes (called by the execution method).
+   virtual void storeGenerated(const std::list<GeomShapePtr>& theFromShapes,
+     const GeomShapePtr& theToShape, const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) = 0;
  
    /// Stores the modified shape (called by the execution method).
    virtual void storeModified(const GeomShapePtr& theOldShape,
                               const GeomShapePtr& theNewShape,
                               const bool theIsCleanStored = true) = 0;
  
+   /// Stores the root modified shapes (called by the execution method).
+   virtual void storeModified(const std::list<GeomShapePtr>& theOldShapes,
+     const GeomShapePtr& theNewShape, const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)=0;
    /// Returns the shape-result produced by this feature
    virtual GeomShapePtr shape() = 0;
  
    virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
                                     const GeomShapePtr& theOldShape,
                                     const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                    const std::string& theName = "") = 0;
+                                    const std::string& theName = "",
+                                    const bool theSaveOldIfNotInTree = false) = 0;
  
    /// load shapes of the first level (to be used during shape import)
    virtual void loadFirstLevel(GeomShapePtr theShape,
index 0f02272be6f08d7b471504093a3547e9d0828f61,00e6ad9efa66564f465359655a4ae76fdbf5eb0e..603aaac4df93d98a740c804eefbafa7a4928d40d
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #include "ModelAPI_ResultBody.h"
@@@ -66,6 -67,21 +66,21 @@@ void ModelAPI_ResultBody::storeGenerate
    updateSubs(theToShape);
  }
  
+ void ModelAPI_ResultBody::storeGenerated(
+   const std::list<GeomShapePtr>& theFromShapes, const GeomShapePtr& theToShape,
+   const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+ {
+   myBuilder->storeGenerated(theFromShapes, theToShape, theMakeShape);
+   myConnect = ConnectionNotComputed;
+   static Events_Loop* aLoop = Events_Loop::loop();
+   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+   aECreator->sendUpdated(data()->owner(), aRedispEvent);
+   updateSubs(theToShape, theFromShapes, theMakeShape, true);
+ }
  void ModelAPI_ResultBody::storeModified(const GeomShapePtr& theOldShape,
                                          const GeomShapePtr& theNewShape,
                                          const bool theIsCleanStored)
    updateSubs(theNewShape);
  }
  
+ void ModelAPI_ResultBody::storeModified(
+   const std::list<GeomShapePtr>& theOldShapes, const GeomShapePtr& theNewShape,
+   const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+ {
+   myBuilder->storeModified(theOldShapes, theNewShape, theMakeShape);
+   myConnect = ConnectionNotComputed;
+   static Events_Loop* aLoop = Events_Loop::loop();
+   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+   aECreator->sendUpdated(data()->owner(), aRedispEvent);
+   updateSubs(theNewShape, theOldShapes, theMakeShape, false);
+ }
  GeomShapePtr ModelAPI_ResultBody::shape()
  {
    return myBuilder->shape();
index 0304b86c5e07efe9a8ce44a9168447c9de0f047a,4918b2791488904b3fb5c1e3186a032081dfca18..0991119bd56c931ed13a666172efc1fe8e2ed15d
@@@ -1,4 -1,4 +1,4 @@@
 -// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 +// Copyright (C) 2014-2019  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
  //
  // 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<mailto:webmaster.salome@opencascade.com>
 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  //
  
  #ifndef ModelAPI_ResultBody_H_
@@@ -101,11 -102,21 +101,21 @@@ public
    MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
                                                const GeomShapePtr& theToShape);
  
+   /// Stores the root modified shapes (called by the execution method).
+   MODELAPI_EXPORT virtual void storeGenerated(
+     const std::list<GeomShapePtr>& theFromShapes, const GeomShapePtr& theToShape,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
    /// Stores the modified shape (called by the execution method).
    MODELAPI_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
                                               const GeomShapePtr& theNewShape,
                                               const bool theIsCleanStored = true);
  
+   /// Stores the root modified shapes (called by the execution method).
+   MODELAPI_EXPORT virtual void storeModified(
+     const std::list<GeomShapePtr>& theOldShapes, const GeomShapePtr& theNewShape,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
    /// Returns the shape-result produced by this feature
    MODELAPI_EXPORT virtual GeomShapePtr shape();
  
    virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
                                     const GeomShapePtr& theOldShape,
                                     const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
-                                    const std::string& theName = "") = 0;
+                                    const std::string& theName = "",
+                                    const bool theSaveOldIfNotInTree = false) = 0;
  
    /// load shapes of the first level (to be used during shape import)
    MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
    MODELAPI_EXPORT virtual void updateSubs(const GeomShapePtr& theThisShape,
      const bool theShapeChanged = true) = 0;
  
+   /// Updates the sub-bodies in accordance to the algorithm history information
+   MODELAPI_EXPORT virtual void updateSubs(
+     const GeomShapePtr& theThisShape, const std::list<GeomShapePtr>& theOlds,
+     const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape, const bool isGenerated) = 0;
    /// Cleans cash related to the already stored elements
    MODELAPI_EXPORT virtual void cleanCash() = 0;
  
index d374315b1dd70c5bdd9c6414f0bafda0ebd3218e,284b28a3070b39ca1ae8bbb4f7d8d3990c23b025..526a6f627d2418f0f26aafb1ce753cd93d2ccee2
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2014-2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2014-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  # -*- coding: utf-8 -*-
  
@@@ -110,10 -111,15 +110,15 @@@ Sketch_3.result().setName("Sketch_4"
  ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), "h", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
  Fillet_1_objects = [model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_16&weak_name_2]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_18&weak_name_2]")]
  Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2)
- Group_1_objects = [model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_1"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_4"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_2"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_3")]
+ Group_1_objects = [
+ model.selection("FACE", "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_14)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_15)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_1)"),
+ model.selection("FACE", "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_11)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_16)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_2)"),
+ model.selection("FACE", "(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_13)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_6)"),
+ model.selection("FACE", "(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_5)(Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9)(Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_12)")
+ ]
  Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
- Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)][Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)]")])
- Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Fillet_1_1/Modified_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][Fillet_1_1/Modified_Face&Sketch_3/SketchLine_12]")])
+ Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9][Fillet_1_1/MF:Fillet_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/GF:Fillet&Fillet_1_1/FilletSelected_9]")])
+ Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/MF:Fillet_Face&Sketch_1/SketchLine_3][Fillet_1_1/MF:Fillet_Face&Sketch_3/SketchLine_12]")])
  model.do()
  
  Folder_1 = model.addFolder(Part_1_doc, Sketch_3, ExtrusionCut_2)
index 2b42d20ccb2b607876c1d1073701b06524dea35d,2b646ca8c975afeddc11e7965612e4a458b974dc..9b40f1c3ae3294438a4935a9b446223949147a90
@@@ -1,21 -1,22 +1,21 @@@
 -## Copyright (C) 2017  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
 -## License as published by the Free Software Foundation; either
 -## version 2.1 of the License, or (at your option) any later version.
 -##
 -## This library is distributed in the hope that it will be useful,
 -## but WITHOUT ANY WARRANTY; without even the implied warranty of
 -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -## Lesser General Public License for more details.
 -##
 -## 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
 -##
 -## See http:##www.salome-platform.org/ or
 -## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 -##
 +# Copyright (C) 2017-2019  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
 +# License as published by the Free Software Foundation; either
 +# version 2.1 of the License, or (at your option) any later version.
 +#
 +# This library is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +# Lesser General Public License for more details.
 +#
 +# 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
 +#
 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 +#
  
  """
      Test moving the entities in the complex sketch by the example of a clamp
@@@ -339,9 -340,9 +339,9 @@@ model.do(
  Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_14f-SketchLine_16r-SketchArc_3_2r-SketchLine_15f-SketchLine_13r-SketchArc_2_2r-SketchCircle_2_2r")], model.selection(), -165, 155)
  Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
  
- Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)"))
+ Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5)"))
  SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0)
- SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Extrusion_1_1/From_Face&Sketch_2/SketchLine_6][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_1&Extrusion_2_1/To_Face][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7]"))
+ SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Sketch_2/SketchLine_6&Extrusion_1_1/From_Face][Fuse_1_1/Modified_Face&Extrusion_2_1/To_Face&Sketch_1/SketchLine_1][Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5]"))
  SketchPoint_2 = SketchProjection_2.createdFeature()
  SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result())
  SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20)
@@@ -364,12 -365,12 +364,12 @@@ SketchArc_5 = Sketch_3.addArc(145, -20
  SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_5.center())
  SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_20.result(), SketchArc_5.endPoint())
  SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_5.startPoint(), SketchLine_19.result())
- SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face][(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)]"))
+ SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face][(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)(Fuse_1_1/Modified_Face&Sketch_2/SketchLine_7&Sketch_1/SketchLine_5)]"))
  SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result())
  model.do()
  
- ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
- ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2f-SketchLine_20r-SketchArc_5_2r-SketchLine_19r")], model.selection(), model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchArc_4_2)(ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_2/SketchLine_9&Sketch_1/SketchLine_2"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
+ ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2f-SketchLine_20r-SketchArc_5_2r-SketchLine_19r")], model.selection(), model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_9&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchArc_4_2)(ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
  model.do()
  
  model.end()