Salome HOME
Merge branch 'BR_internationalization'
[modules/shaper.git] / src / SketchSolver / SketchSolver_Group.cpp
index 0471488f38ce6d095e124209d8a031cc7c36ffc2..144adbfe3e40b3b4d2c42ec9f5f3a9f1af4a413f 100644 (file)
@@ -328,7 +328,8 @@ bool SketchSolver_Group::resolveConstraints()
 {
   bool aResolved = false;
   bool isGroupEmpty = isEmpty() && myStorage->isEmpty();
-  if (myStorage->isNeedToResolve() && !isGroupEmpty) {
+  if (myStorage->isNeedToResolve() &&
+      (!isGroupEmpty || !myConflictingConstraints.empty() || myPrevResult == STATUS_FAILED)) {
     if (!mySketchSolver)
       mySketchSolver = SketchSolver_Manager::instance()->builder()->createSolver();
 
@@ -341,7 +342,7 @@ bool SketchSolver_Group::resolveConstraints()
     try {
       if (myStorage->hasDuplicatedConstraint())
         aResult = STATUS_INCONSISTENT;
-      else {
+      else if (!isGroupEmpty) {
         // To avoid overconstraint situation, we will remove temporary constraints one-by-one
         // and try to find the case without overconstraint
         bool isLastChance = false;
@@ -376,10 +377,11 @@ bool SketchSolver_Group::resolveConstraints()
       updateMultiConstraints(myConstraints);
       if (myPrevResult != STATUS_OK || myPrevResult == STATUS_UNKNOWN) {
         getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
-        // the error message should be changed before sending the message
-        sendMessage(EVENT_SOLVER_REPAIRED, myConflictingConstraints);
+        std::set<ObjectPtr> aConflicting = myConflictingConstraints;
         myConflictingConstraints.clear();
         myPrevResult = STATUS_OK;
+        // the error message should be changed before sending the message
+        sendMessage(EVENT_SOLVER_REPAIRED, aConflicting);
       }
     } else {
       mySketchSolver->undo();