]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #690 Application hangs up when Create Arc after Rotation
authornds <natalia.donis@opencascade.com>
Wed, 8 Jul 2015 13:24:07 +0000 (16:24 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 8 Jul 2015 13:40:33 +0000 (16:40 +0300)
src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp
src/SketchSolver/SketchSolver_ConstraintRigid.cpp

index 532097e9935d3b2deac470366824d307ee446953..5144f14fc6bcf6fce4d8a7e266abcb16c376b254 100644 (file)
@@ -67,7 +67,6 @@ void SketchSolver_ConstraintCoincidence::attach(
     std::shared_ptr<SketchSolver_ConstraintCoincidence> theConstraint)
 {
   cleanErrorMsg();
-  Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front());
   // Remove constraints from theConstraint
   std::vector<Slvs_hConstraint>::iterator aCIter = theConstraint->mySlvsConstraints.begin();
   for (; aCIter != theConstraint->mySlvsConstraints.end(); aCIter++)
@@ -129,9 +128,13 @@ void SketchSolver_ConstraintCoincidence::addConstraint(ConstraintPtr theConstrai
     myCoincidentPoints.insert(aRefAttr->attr());
   }
 
-  Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front());
   Slvs_hConstraint aNewConstr = SLVS_E_UNKNOWN;
   std::vector<Slvs_hEntity>::iterator anEntIter = anEntities.begin();
+  if (mySlvsConstraints.empty()) {
+    aNewConstr = addConstraint(*anEntIter, *(anEntIter + 1));
+    anEntIter += 2;
+  }
+  Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front());
   for (; anEntIter != anEntities.end(); anEntIter++)
     aNewConstr = addConstraint(aBaseCoincidence.ptA, *anEntIter);
   myExtraCoincidence[aNewConstr] = theConstraint;
@@ -212,12 +215,14 @@ bool SketchSolver_ConstraintCoincidence::remove(ConstraintPtr theConstraint)
       // Need to specify another base coincidence constraint
       myBaseConstraint = anExtraIt->second;
       myExtraCoincidence.erase(anExtraIt);
-      std::vector<Slvs_hConstraint>::iterator aCIter = mySlvsConstraints.begin();
-      Slvs_Constraint aBase = myStorage->getConstraint(*aCIter);
-      for (++aCIter; aCIter != mySlvsConstraints.end(); aCIter++) {
-        Slvs_Constraint aConstr = myStorage->getConstraint(*aCIter);
-        aConstr.ptA = aBase.ptA;
-        myStorage->updateConstraint(aConstr);
+      if (mySlvsConstraints.empty()) {
+        std::vector<Slvs_hConstraint>::iterator aCIter = mySlvsConstraints.begin();
+        Slvs_Constraint aBase = myStorage->getConstraint(*aCIter);
+        for (++aCIter; aCIter != mySlvsConstraints.end(); aCIter++) {
+          Slvs_Constraint aConstr = myStorage->getConstraint(*aCIter);
+          aConstr.ptA = aBase.ptA;
+          myStorage->updateConstraint(aConstr);
+        }
       }
     }
   }
index ff52e577437e5f8db91ae8a17077de087fa94395..c5043d945674fdbd04cdee7d0f6b35bee654ddd0 100644 (file)
@@ -163,6 +163,7 @@ bool SketchSolver_ConstraintRigid::remove(ConstraintPtr theConstraint)
     myFeatureMap.clear();
     myAttributeMap.clear();
     myValueMap.clear();
+    mySlvsConstraints.clear();
   } else
     cleanRemovedEntities();
   return true;