From 9634da681109552eb7d9ec51ce93215372eaa10d Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 29 Dec 2017 17:33:09 +0100 Subject: [PATCH] Sketcher: Block constraint - Prevent from adding constraint if the solver has redundant/conflicting constraints --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 21a94aa939..a12cdbfb14 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1814,7 +1814,7 @@ CmdSketcherConstrainBlocked::CmdSketcherConstrainBlocked() void CmdSketcherConstrainBlocked::activated(int iMsg) { - Q_UNUSED(iMsg); + Q_UNUSED(iMsg); // get the selection std::vector selection = getSelection().getSelectionEx(); @@ -1838,6 +1838,13 @@ void CmdSketcherConstrainBlocked::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); + + // Check that the solver does not report redundant/conflicting constraints + if(Obj->getLastSolverStatus()!=GCS::Success || Obj->getLastHasConflicts() || Obj->getLastHasRedundancies()) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong solver status"), + QObject::tr("A block constraint can not be added if the sketch is unsolved or there are redundant and/or conflicting constraints.")); + return; + } std::vector GeoId;