From c2dd10b41a9e496b5a3930d7c8705154ffeee179 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 3 Jan 2021 18:47:45 +0100 Subject: [PATCH] Sketcher: Treat malformed solver constraints as an error during recompute ========================================================================= Sometimes it happens that malformed constraints are arrived to. Example: https://forum.freecadweb.org/viewtopic.php?f=3&t=53780#p463271 It is not the first time. They usually go under the radar and when they are detected is too late to know what caused them. The user is desperate too. This commit makes malformed constraints to prevent the recompute of the project. This is in the best interest of the user. --- src/Mod/Sketcher/App/SketchObject.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 932baf7431..ef0efeecb8 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -216,6 +216,9 @@ App::DocumentObjectExecReturn *SketchObject::execute(void) else if (err == -1) { // Solver failed return new App::DocumentObjectExecReturn("Solving the sketch failed",this); } + else if (solvedSketch.hasMalformedConstraints()) { + return new App::DocumentObjectExecReturn("Sketch has malformed constraints"); + } // this is not necessary for sketch representation in edit mode, unless we want to trigger an update of // the objects that depend on this sketch (like pads)