From df36d894e2288718e4f4246c24103b9bdb68aa8b Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 21 Apr 2016 10:45:13 +0300 Subject: [PATCH] Fix regression in TestRectangle.py --- src/SketchPlugin/Test/TestRectangle.py | 18 +++++++++--------- src/SketchSolver/SketchSolver_Group.cpp | 3 --- src/SketchSolver/SketchSolver_Manager.cpp | 3 --- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/SketchPlugin/Test/TestRectangle.py b/src/SketchPlugin/Test/TestRectangle.py index aafdd9c1c..d4c7061a3 100644 --- a/src/SketchPlugin/Test/TestRectangle.py +++ b/src/SketchPlugin/Test/TestRectangle.py @@ -76,15 +76,15 @@ aSession.finishOperation() #========================================================================= # Check the lines of rectangle are parallel to the axes #========================================================================= -#aNbSubs = aSketchFeature.numberOfSubs() -#aNbLines = 0 -#for i in range (0, aNbSubs): -# aFeature = objectToFeature(aSketchFeature.subFeature(i)) -# if aFeature.getKind() == "SketchLine": -# aLastLine = aFeature -# assert (isHorizontal(aLastLine) or isVertical(aLastLine)) -# aNbLines = aNbLines + 1 -#assert (aNbLines == 4) +aNbSubs = aSketchFeature.numberOfSubs() +aNbLines = 0 +for i in range (0, aNbSubs): + aFeature = objectToFeature(aSketchFeature.subFeature(i)) + if aFeature.getKind() == "SketchLine": + aLastLine = aFeature + assert (isHorizontal(aLastLine) or isVertical(aLastLine)) + aNbLines = aNbLines + 1 +assert (aNbLines == 4) #========================================================================= # End of test #========================================================================= diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 1ee8c9e3d..c60de6f38 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -363,7 +363,6 @@ bool SketchSolver_Group::resolveConstraints() } catch (...) { // Events_Error::send(SketchSolver_Error::SOLVESPACE_CRASH(), this); getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::SOLVESPACE_CRASH()); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); if (myPrevResult == STATUS_OK || myPrevResult == STATUS_UNKNOWN) { // the error message should be changed before sending the message sendMessage(EVENT_SOLVER_FAILED); @@ -377,7 +376,6 @@ bool SketchSolver_Group::resolveConstraints() updateMultiConstraints(myConstraints); if (myPrevResult != STATUS_OK || myPrevResult == STATUS_UNKNOWN) { getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(""); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); // the error message should be changed before sending the message sendMessage(EVENT_SOLVER_REPAIRED, myConflictingConstraints); myConflictingConstraints.clear(); @@ -388,7 +386,6 @@ bool SketchSolver_Group::resolveConstraints() if (!myConstraints.empty()) { // the error message should be changed before sending the message getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::CONSTRAINTS()); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); if (myPrevResult != aResult || myPrevResult == STATUS_UNKNOWN) { // Obtain list of conflicting constraints std::set aConflicting = myStorage->getConflictingConstraints(mySketchSolver); diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 38125d267..82f0c826b 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -235,7 +235,6 @@ void SketchSolver_Manager::checkConflictingConstraints(const std::shared_ptrgetWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue( SketchSolver_Error::CONSTRAINTS()); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); break; } } @@ -576,8 +575,6 @@ void SketchSolver_Manager::degreesOfFreedom() std::ostringstream aStream; aStream << "DOF(degree of freedom) = " << aDoFIt->second; aDoFIt->first->data()->string(SketchPlugin_Sketch::SOLVER_DOF())->setValue(aStream.str()); - - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } } -- 2.39.2