From 0e8b1e9bddca0d41e27e812e4c4c9fa58a48629f Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 16 Apr 2015 07:24:45 +0300 Subject: [PATCH] CRash when move circle with Radius constraint --- src/SketchSolver/SketchSolver_ConstraintRigid.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp index 3ab5794b2..d13285362 100644 --- a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp @@ -239,6 +239,13 @@ void SketchSolver_ConstraintRigid::fixCircle(const Slvs_Entity& theCircle) fixPoint(theCircle.point[0]); if (isFixRadius) { + // Search the radius is already fixed + std::list aDiamConstr = myStorage->getConstraintsByType(SLVS_C_DIAMETER); + std::list::const_iterator aDiamIter = aDiamConstr.begin(); + for (; aDiamIter != aDiamConstr.end(); aDiamIter++) + if (aDiamIter->entityA == theCircle.h) + return; + // Fix radius of a circle AttributeDoublePtr aRadiusAttr = std::dynamic_pointer_cast( myFeatureMap.begin()->first->attribute(SketchPlugin_Circle::RADIUS_ID())); @@ -312,7 +319,7 @@ void SketchSolver_ConstraintRigid::fixArc(const Slvs_Entity& theArc) std::list aDiamConstraints = myStorage->getConstraintsByType(SLVS_C_DIAMETER); std::list::iterator anIt = aDiamConstraints.begin(); for (; anIt != aDiamConstraints.end() && !isExists; anIt++) - if (anIt->entityA == myFeatureMap.begin()->second) + if (anIt->entityA == theArc.h) isExists = true; if (!isExists) { Slvs_Constraint aFixedR = Slvs_MakeConstraint(SLVS_E_UNKNOWN, myGroup->getId(), SLVS_C_DIAMETER, -- 2.39.2