From c18563d92e3adcaa7979701c72603b833d668312 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 3 Mar 2016 16:36:38 +0300 Subject: [PATCH] Translation problem (issue #1350) --- src/SketchSolver/SketchSolver_Group.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 6a2dc0a00..3fad1d4ad 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -196,6 +196,7 @@ bool SketchSolver_Group::changeConstraint( return true; } +// Update constraints if they contain specific feature static void updateMultiConstraints(ConstraintConstraintMap& theConstraints, FeaturePtr theFeature) { ConstraintConstraintMap::iterator aCIt = theConstraints.begin(); @@ -212,6 +213,18 @@ static void updateMultiConstraints(ConstraintConstraintMap& theConstraints, Feat } } +// Recalculate slave features of the Multi constraints +static void updateMultiConstraints(ConstraintConstraintMap& theConstraints) +{ + ConstraintConstraintMap::iterator aCIt = theConstraints.begin(); + for (; aCIt != theConstraints.end(); ++aCIt) { + SketchSolver_ConstraintType aType = aCIt->second->getType(); + if ((aType == CONSTRAINT_MULTI_ROTATION || + aType == CONSTRAINT_MULTI_TRANSLATION)) + std::dynamic_pointer_cast(aCIt->second)->update(true); + } +} + bool SketchSolver_Group::updateFeature(FeaturePtr theFeature) { if (!checkFeatureValidity(theFeature)) @@ -356,6 +369,7 @@ bool SketchSolver_Group::resolveConstraints() } if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET) { // solution succeeded, store results into correspondent attributes myStorage->refresh(); + 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 -- 2.39.2