From 93c836fdcf2601217f40f0ef44a399c617fd71c7 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 19 Jun 2015 13:45:20 +0200 Subject: [PATCH] Sketcher: Bug fix Trim ====================== In no update mode, the last constraint was not enforced. The DoF was not properly shown. The trim operation it is always solved at the end now if in no recompute mode. --- src/Mod/Sketcher/App/SketchObject.cpp | 41 +++++++++++++++++++++-- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 2 +- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index d5b8d183b..febccb020 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1024,8 +1024,11 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) newConstr->FirstPos = none; newConstr->Second = newGeoId; addConstraint(newConstr); - delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } } else if (x1 < 0.001*length) { // drop the first intersection point @@ -1070,6 +1073,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } else if (x1 < x0) { // trim line end @@ -1086,6 +1093,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } } @@ -1166,6 +1177,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; } @@ -1253,7 +1267,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; - + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } } else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { @@ -1345,6 +1362,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; } else @@ -1391,6 +1411,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } else { // trim arc end @@ -1408,6 +1432,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } } @@ -1511,6 +1539,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; } else @@ -1560,6 +1591,10 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) addConstraint(newConstr); delete newConstr; + + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); + return 0; } else { // trim arc end @@ -1567,6 +1602,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) Part::GeomArcOfEllipse *aoe1 = dynamic_cast(geomlist[GeoId]); aoe1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true); + if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver + solve(); return 0; } } diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 6fc132b0b..f81636ff3 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -4365,7 +4365,7 @@ public: bool autoRecompute = hGrp->GetBool("AutoRecompute",false); if(autoRecompute) - Gui::Command::updateActive(); + Gui::Command::updateActive(); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what());