From: nds Date: Wed, 8 Jul 2015 13:24:07 +0000 (+0300) Subject: Issue #690 Application hangs up when Create Arc after Rotation X-Git-Tag: V_1.3.0~73 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7d4de9b9e96eebea4c01691b9d4f740a9519dd7;p=modules%2Fshaper.git Issue #690 Application hangs up when Create Arc after Rotation --- diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index 532097e99..5144f14fc 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -67,7 +67,6 @@ void SketchSolver_ConstraintCoincidence::attach( std::shared_ptr theConstraint) { cleanErrorMsg(); - Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front()); // Remove constraints from theConstraint std::vector::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::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::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::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); + } } } } diff --git a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp index ff52e5774..c5043d945 100644 --- a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp @@ -163,6 +163,7 @@ bool SketchSolver_ConstraintRigid::remove(ConstraintPtr theConstraint) myFeatureMap.clear(); myAttributeMap.clear(); myValueMap.clear(); + mySlvsConstraints.clear(); } else cleanRemovedEntities(); return true;