Salome HOME
Issue #2123: Unexpected Sketcher behavior when creating Coincidence
[modules/shaper.git] / src / ModuleBase / ModuleBase_IModule.cpp
index fe5bff496eceae0bfe665b358a8a558a6590a0d7..ca6c1b1bc234dec3a25fd0bdcfc333319b33c24e 100644 (file)
@@ -86,6 +86,11 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId,
   QList<ModuleBase_ViewerPrsPtr> aPreSelected =
     aSelection->getSelected(ModuleBase_ISelection::AllControls);
 
+  ModuleBase_OperationFeature* aCurOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                                         (myWorkshop->currentOperation());
+  QString anOperationKind = aCurOperation ? aCurOperation->getDescription()->operationId() : "";
+
+
   bool isCommitted;
   if (!myWorkshop->canStartOperation(theCmdId, isCommitted))
     return;
@@ -101,7 +106,7 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId,
     if (aMessage.get()) {
       setReentrantPreSelection(aMessage);
     }
-    else
+    else if (anOperationKind == theCmdId) // restore of selection only if the kind is the same
       aFOperation->initSelection(aPreSelected);
 
     workshop()->processLaunchOperation(aFOperation);