Sketcher: Solver information: Bug fix
===================================== When the solver converged (but did not succeed) or when the solver succeded but the solution is not OCC-valid, no error message was shown in the solver messages dialog.
This commit is contained in:
parent
4fb15f2a1b
commit
fc128d357d
|
@ -2186,6 +2186,7 @@ int Sketch::solve(void)
|
||||||
GCSsys.undoSolution();
|
GCSsys.undoSolution();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
Base::Console().Warning("Invalid solution from %s solver.\n", solvername.c_str());
|
Base::Console().Warning("Invalid solution from %s solver.\n", solvername.c_str());
|
||||||
|
ret = GCS::SuccessfulSolutionInvalid;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
updateNonDrivingConstraints();
|
updateNonDrivingConstraints();
|
||||||
|
|
|
@ -141,6 +141,9 @@ App::DocumentObjectExecReturn *SketchObject::execute(void)
|
||||||
lastConflicting=solvedSketch.getConflicting();
|
lastConflicting=solvedSketch.getConflicting();
|
||||||
lastRedundant=solvedSketch.getRedundant();
|
lastRedundant=solvedSketch.getRedundant();
|
||||||
|
|
||||||
|
lastSolveTime=0.0;
|
||||||
|
lastSolverStatus=GCS::Failed; // Failure is default for notifying the user unless otherwise proven
|
||||||
|
|
||||||
solverNeedsUpdate=false;
|
solverNeedsUpdate=false;
|
||||||
|
|
||||||
if (lastDoF < 0) { // over-constrained sketch
|
if (lastDoF < 0) { // over-constrained sketch
|
||||||
|
@ -211,8 +214,14 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/)
|
||||||
err = -3;
|
err = -3;
|
||||||
else {
|
else {
|
||||||
lastSolverStatus=solvedSketch.solve();
|
lastSolverStatus=solvedSketch.solve();
|
||||||
if (lastSolverStatus != 0) // solving
|
if (lastSolverStatus != 0){ // solving
|
||||||
err = -2;
|
err = -2;
|
||||||
|
// if solver failed, geometry was never updated, but invalid constraints were likely added before
|
||||||
|
// solving (see solve in addConstraint), so solver information is definitely invalid.
|
||||||
|
this->Constraints.touch();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lastHasRedundancies = solvedSketch.hasRedundancies();
|
lastHasRedundancies = solvedSketch.hasRedundancies();
|
||||||
|
|
|
@ -39,9 +39,10 @@ namespace GCS
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
enum SolveStatus {
|
enum SolveStatus {
|
||||||
Success = 0, // Found a solution zeroing the error function
|
Success = 0, // Found a solution zeroing the error function
|
||||||
Converged = 1, // Found a solution minimizing the error function
|
Converged = 1, // Found a solution minimizing the error function
|
||||||
Failed = 2 // Failed to find any solution
|
Failed = 2, // Failed to find any solution
|
||||||
|
SuccessfulSolutionInvalid = 3, // This is a solution where the solver succeeded, but the resulting geometry is OCE-invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Algorithm {
|
enum Algorithm {
|
||||||
|
|
|
@ -4374,10 +4374,10 @@ void ViewProviderSketch::UpdateSolverInformation()
|
||||||
signalSetUp(tr("Under-constrained sketch with %1 degrees of freedom").arg(dofs));
|
signalSetUp(tr("Under-constrained sketch with %1 degrees of freedom").arg(dofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
signalSolved(tr("Solved in %1 sec").arg(getSketchObject()->getLastSolveTime()));
|
signalSolved(QString::fromLatin1("<font color='green'>%1</font>").arg(tr("Solved in %1 sec").arg(getSketchObject()->getLastSolveTime())));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
signalSolved(tr("Unsolved (%1 sec)").arg(getSketchObject()->getLastSolveTime()));
|
signalSolved(QString::fromLatin1("<font color='red'>%1</font>").arg(tr("Unsolved (%1 sec)").arg(getSketchObject()->getLastSolveTime())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user