]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_OverconstraintListener.cpp
Salome HOME
Issue #3262: Undo automatic constraint even several conflicting objects were sent
[modules/shaper.git] / src / PartSet / PartSet_OverconstraintListener.cpp
index a0eff2c34b011e8f26821d22bb0df2b9553379b9..f94b112136735e710515eee678d556f5231a06cd 100644 (file)
@@ -245,30 +245,32 @@ bool PartSet_OverconstraintListener::appendConflictingObjects(
   // set error state for new objects and append them in the internal map of objects
   std::set<ObjectPtr>::const_iterator
     anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+  FeaturePtr aFeature;
+  bool isHVConstraint = false;
   for (; anIt != aLast; anIt++) {
     ObjectPtr anObject = *anIt;
     if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found
       aModifiedObjects.insert(anObject);
       myConflictingObjects.insert(anObject);
     }
+    if (!isHVConstraint) {
+      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
+      if (aFeature) {
+        std::string aType = aFeature->getKind();
+        isHVConstraint = (aType == SketchPlugin_ConstraintHorizontal::ID()) ||
+          (aType == SketchPlugin_ConstraintVertical::ID());
+      }
+    }
   }
   bool isUpdated = !aModifiedObjects.empty();
   if (isUpdated)
     redisplayObjects(aModifiedObjects);
 
-  if (myConflictingObjects.size() == 1) {
-    // If the conflicting object is an automatic constraint caused the conflict
-    // then it has to be deleted
-    ObjectPtr aObj = *theConflictingObjects.cbegin();
-    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
-    if (aFeature) {
-      std::string aType = aFeature->getKind();
-      if ((aType == SketchPlugin_ConstraintHorizontal::ID()) ||
-        (aType == SketchPlugin_ConstraintVertical::ID())) {
-        PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
-        QTimer::singleShot(5, aModule, SLOT(onConflictingConstraints()));
-      }
-    }
+  // If the conflicting object is an automatic constraint caused the conflict
+  // then it has to be deleted
+  if (isHVConstraint) {
+    PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+    QTimer::singleShot(5, aModule, SLOT(onConflictingConstraints()));
   }
 
   return isUpdated;