]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid problems with mirror constraint
authorazv <azv@opencascade.com>
Wed, 18 Mar 2015 13:01:47 +0000 (16:01 +0300)
committerazv <azv@opencascade.com>
Wed, 18 Mar 2015 13:01:47 +0000 (16:01 +0300)
src/SketchSolver/SketchSolver_ConstraintGroup.cpp

index 9a0f29050970ef9b62a59bdefc8370336cf5bac6..4340f7018f0a6bba42d3ceb987375827b86ba245 100644 (file)
@@ -711,7 +711,7 @@ bool SketchSolver_ConstraintGroup::changeMirrorConstraint(
         } else if (aBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
           int aBaseArcInd[3] = {0, 1, 2}; // indices of points of arc, center corresponds center, first point corresponds last point
           int aMirrorArcInd[3] = {0, 2, 1};
-          for (int ind = 0; ind < 2; ind++) {
+          for (int ind = 0; ind < 3; ind++) {
             Slvs_Constraint aConstraint = Slvs_MakeConstraint(
                 ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
                 myEntities[aBasePos].point[aBaseArcInd[ind]], myEntities[aMirrorPos].point[aMirrorArcInd[ind]],
@@ -722,14 +722,20 @@ bool SketchSolver_ConstraintGroup::changeMirrorConstraint(
         }
       }
     }
-  }
 
-  // Set the mirror line unchanged during constraint recalculation
-  if (aConstrAttr->isObject()) {
-    addTemporaryConstraintWhereDragged(aMirrorLineFeat->attribute(SketchPlugin_Line::START_ID()));
-    addTemporaryConstraintWhereDragged(aMirrorLineFeat->attribute(SketchPlugin_Line::END_ID()));
+    // Set the mirror line unchanged during constraint recalculation
+    int aMirrorLinePos = Search(aMirrorLineEnt, myEntities);
+    Slvs_Constraint aRigidStart = Slvs_MakeConstraint(
+        ++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, myWorkplane.h, 0,
+        myEntities[aMirrorLinePos].point[0], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
+    myConstraints.push_back(aRigidStart);
+    myConstraintMap[theConstraint].push_back(aRigidStart.h);
+    Slvs_Constraint aRigidEnd = Slvs_MakeConstraint(
+        ++myConstrMaxID, myID, SLVS_C_WHERE_DRAGGED, myWorkplane.h, 0,
+        myEntities[aMirrorLinePos].point[1], SLVS_E_UNKNOWN, SLVS_E_UNKNOWN, SLVS_E_UNKNOWN);
+    myConstraints.push_back(aRigidEnd);
+    myConstraintMap[theConstraint].push_back(aRigidEnd.h);
   }
-  else addTemporaryConstraintWhereDragged(aConstrAttr->attr());
   return true;
 }