From: azv Date: Thu, 10 Sep 2015 05:38:43 +0000 (+0300) Subject: Strange conflicting constraints error (issue #936) X-Git-Tag: V_1.4.0_beta4~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1966f3b5613cf52906cc0ed2771e541c4ec15c21;p=modules%2Fshaper.git Strange conflicting constraints error (issue #936) 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. --- diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index c965b8ee9..ecd78c9cd 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -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) { diff --git a/src/SketchSolver/SketchSolver_Solver.cpp b/src/SketchSolver/SketchSolver_Solver.cpp index 4e7a4f0e9..a935ec9e2 100644 --- a/src/SketchSolver/SketchSolver_Solver.cpp +++ b/src/SketchSolver/SketchSolver_Solver.cpp @@ -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)); }