From 339717c96fd755b036ad38cead6030cf5c69c01d Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 7 Jun 2015 15:43:44 +0200 Subject: [PATCH] Sketcher: Bug fix of New Solver Model: DoF and solver update on deletion of constraints ========================================================= Upon deletion of a constraint, the constraint was still enforced for UI operations (dragging of a point) and DoF was not updated. --- src/Mod/Sketcher/App/SketchObject.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 0756414d4..c16890b32 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -556,6 +556,10 @@ int SketchObject::delGeometry(int GeoId) this->Constraints.setValues(newConstraints); this->Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } @@ -647,6 +651,10 @@ int SketchObject::delConstraint(int ConstrId) std::vector< Constraint * > newVals(vals); newVals.erase(newVals.begin()+ConstrId); this->Constraints.setValues(newVals); + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } @@ -659,6 +667,7 @@ int SketchObject::delConstraintOnPoint(int VertexId, bool onlyCoincident) PosId = start; } else getGeoVertexIndex(VertexId, GeoId, PosId); + return delConstraintOnPoint(GeoId, PosId, onlyCoincident); } @@ -764,6 +773,10 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc } if (newVals.size() < vals.size()) { this->Constraints.setValues(newVals); + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } @@ -1934,6 +1947,9 @@ int SketchObject::delConstraintsToExternal() Constraints.setValues(newConstraints); Constraints.acceptGeometry(getCompleteGeometry()); + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; }