]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Strange conflicting constraints error (issue #936)
authorazv <azv@opencascade.com>
Thu, 10 Sep 2015 05:38:43 +0000 (08:38 +0300)
committerazv <azv@opencascade.com>
Thu, 10 Sep 2015 05:39:44 +0000 (08:39 +0300)
1. The error message on the sketch may be rewritten by another sketch, solved correctly. This behavior is updated.
2. Implemented possibility to receive wrong constraints.

src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SketchSolver_Solver.cpp

index c965b8ee98e11f690d6f06b899160864e33142a7..ecd78c9cd08f32ccbda47b7a188e419d003f4261 100644 (file)
@@ -521,8 +521,8 @@ bool SketchSolver_Group::resolveConstraints()
       if (!myPrevSolved) {
         sendMessage(EVENT_SOLVER_REPAIRED);
         myPrevSolved = true;
+        getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
       }
-      getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
     } else if (!myConstraints.empty()) {
 //      Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);
       if (myPrevSolved) {
index 4e7a4f0e9269f7e2d76ad8219a130fce099864f3..a935ec9e2d0e3d0929418399ce2fa41b33f9c3dd 100644 (file)
@@ -33,8 +33,10 @@ SketchSolver_Solver::~SketchSolver_Solver()
 {
   if (myEquationsSystem.constraint)
     delete[] myEquationsSystem.constraint;
+  myEquationsSystem.constraint = 0;
   if (myEquationsSystem.failed)
     delete[] myEquationsSystem.failed;
+  myEquationsSystem.failed = 0;
 }
 
 void SketchSolver_Solver::setParameters(Slvs_Param* theParameters, int theSize)
@@ -61,15 +63,20 @@ void SketchSolver_Solver::setConstraints(Slvs_Constraint* theConstraints, int th
   if (!myEquationsSystem.constraint) {
     myEquationsSystem.constraint = new Slvs_Constraint[theSize];
     myEquationsSystem.constraints = theSize;
+    myEquationsSystem.failed = new Slvs_hConstraint[theSize];
   }
   else if (myEquationsSystem.constraints != theSize) {
     if (theSize > myEquationsSystem.constraints) {
       delete[] myEquationsSystem.constraint;
       myEquationsSystem.constraint = new Slvs_Constraint[theSize];
+      if (myEquationsSystem.failed)
+        delete[] myEquationsSystem.failed;
+      myEquationsSystem.failed = new Slvs_hConstraint[theSize];
     }
     myEquationsSystem.constraints = theSize;
   }
   memcpy(myEquationsSystem.constraint, theConstraints, theSize * sizeof(Slvs_Constraint));
+  memset(myEquationsSystem.failed, SLVS_C_UNKNOWN, theSize * sizeof(Slvs_hConstraint));
 }