From: azv Date: Fri, 29 May 2015 11:26:47 +0000 (+0300) Subject: Issue #542: Wrong arc created on existing points X-Git-Tag: V_1.2.0~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d16f67f43a8a805f8d1e5ef0f8f309ccefd2b5d;p=modules%2Fshaper.git Issue #542: Wrong arc created on existing points --- diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 6a7ecdb09..27f7b76d1 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -569,11 +569,16 @@ void SketchSolver_Constraint::refresh() { cleanErrorMsg(); std::map::iterator anAttrIter = myAttributeMap.begin(); - for (; anAttrIter != myAttributeMap.end(); anAttrIter++) { + while (anAttrIter != myAttributeMap.end()) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anAttrIter->first); + Slvs_Entity anEntity = myStorage->getEntity(anAttrIter->second); + if (anEntity.h == SLVS_E_UNKNOWN) { + std::map::iterator aTmpIter = anAttrIter++; + myAttributeMap.erase(aTmpIter); + continue; + } if (aPoint) { - Slvs_Entity anEntity = myStorage->getEntity(anAttrIter->second); double aXYZ[3]; for (int i = 0; i < 3; i++) { Slvs_Param aPar = myStorage->getParameter(anEntity.param[i]); @@ -588,7 +593,6 @@ void SketchSolver_Constraint::refresh() std::shared_ptr aPoint2D = std::dynamic_pointer_cast(anAttrIter->first); if (aPoint2D) { - Slvs_Entity anEntity = myStorage->getEntity(anAttrIter->second); double aXY[2]; for (int i = 0; i < 2; i++) { Slvs_Param aPar = myStorage->getParameter(anEntity.param[i]); @@ -602,13 +606,13 @@ void SketchSolver_Constraint::refresh() AttributeDoublePtr aScalar = std::dynamic_pointer_cast(anAttrIter->first); if (aScalar) { - Slvs_Entity anEntity = myStorage->getEntity(anAttrIter->second); Slvs_Param aPar = myStorage->getParameter(anEntity.param[0]); if (fabs(aScalar->value() - aPar.val) > tolerance) aScalar->setValue(aPar.val); } } } + anAttrIter++; } std::map::iterator aValIter = myValueMap.begin();