Sketcher: Automatic redundant removal mechanism

===============================================

It is a long felt need that redundant constraints are not generated while autoconstraining.

The solver sketcher in v0.17 is überpicky with redundants due to the new popularity contest algorithm. The former behaviour is exhacerbated.

This new mode enables automatic redundant constraint removal.

In UI operations IN EDIT MODE, upon detection of redundancy by the solver, the Sketcher will remove all redundant constraints detected by that solve.

This makes the sketcher much less annoying.

How to test this?

The easiest example is to create a vertical line. Then make the endpoints symmetric with respect to the horizontal axis. Without this mode,
the vertical constraint and the symmetry constraint are redundant. With this mode, the vertical constraint gets automatically removed by the Sketcher.
This commit is contained in:
Abdullah Tahiri
2018-08-22 09:33:49 +02:00
committed by wmayer
parent 716d53b86e
commit 779b4f641d
7 changed files with 108 additions and 80 deletions

View File

@@ -1196,6 +1196,8 @@ public:
createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::end);
sugConstr2.clear();
}
tryAutoRecomputeIfNotSolve(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
unsetCursor();
@@ -5832,7 +5834,7 @@ public:
Gui::Command::abortCommand();
}
tryAutoRecompute();
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
if(construction) {
Gui::Command::doCommand(Gui::Command::Doc,
@@ -6008,7 +6010,7 @@ public:
sketchgui->getObject()->getNameInDocument(),
GeoId, onSketchPos.x, onSketchPos.y);
Gui::Command::commitCommand();
tryAutoRecompute();
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
}
catch (const Base::Exception& e) {
Base::Console().Error("Failed to trim edge: %s\n", e.what());
@@ -7070,7 +7072,7 @@ public:
Base::Console().Error("Failed to add slot: %s\n", e.what());
Gui::Command::abortCommand();
tryAutoRecompute();
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
}
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
@@ -7300,7 +7302,7 @@ public:
Base::Console().Error("Failed to add hexagon: %s\n", e.what());
Gui::Command::abortCommand();
tryAutoRecompute();
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
}
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");