]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Translation problem (issue #1350)
authorazv <azv@opencascade.com>
Thu, 3 Mar 2016 13:36:38 +0000 (16:36 +0300)
committerazv <azv@opencascade.com>
Thu, 3 Mar 2016 13:37:33 +0000 (16:37 +0300)
src/SketchSolver/SketchSolver_Group.cpp

index 6a2dc0a0009fa1f0f095baf48ab67a5df3dfcd38..3fad1d4ad4e2528eed0ffe1e4a57818866a1f88b 100644 (file)
@@ -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<SketchSolver_ConstraintMulti>(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