Salome HOME
Merge commit 'f709219506b7cd587e94abc5ebed18d629df92d8'
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_MultiTranslation.cpp
index 887f159f8a48ac2113d88ebac11658aab8cf7b10..e30ea0fbf81590c5b17ad7f7cb42c181454bfbeb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -93,6 +93,11 @@ void SketchPlugin_MultiTranslation::execute()
   if (isUpdateFlushed)
     Events_Loop::loop()->setFlushed(anUpdateEvent, false);
 
+  // Save the current feature of the document, because new features may appear while executing.
+  // In this case, they will become current. But if the number of copies is updated from outside
+  // of sketch (e.g. by parameter change), the history line should not hold in sketch.
+  keepCurrentFeature();
+
   AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
       aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
   AttributeRefListPtr aRefListOfTranslated = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
@@ -201,6 +206,8 @@ void SketchPlugin_MultiTranslation::execute()
     }
   }
 
+  restoreCurrentFeature();
+
   // send events to update the sub-features by the solver
   if (isUpdateFlushed)
     Events_Loop::loop()->setFlushed(anUpdateEvent, true);