Sketcher: Bug fixes to Auto-Update Mode

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

- Fixing toggle AutoUpdate Mode
- Fix Auto-Update Sketcher tools
- Fix missing createGeo recomputes
- Missing constraints recomputes fixed

Various fixes for non-Update mode:
- Fixes lack of update upon entering a conflicting datum constraint.
- Fixes lack of update upon setting the reference/driving status of a constraint

- Added tooltips to buttons
This commit is contained in:
Abdullah Tahiri 2015-06-08 15:04:09 +02:00 committed by wmayer
parent 339717c96f
commit 4b0bd78814
6 changed files with 118 additions and 17 deletions

View File

@ -289,6 +289,9 @@ int SketchObject::setDriving(int ConstrId, bool isdriving)
newVals[ConstrId] = constNew;
this->Constraints.setValues(newVals);
delete constNew;
if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();
return 0;
}
@ -342,6 +345,9 @@ int SketchObject::toggleDriving(int ConstrId)
newVals[ConstrId] = constNew;
this->Constraints.setValues(newVals);
delete constNew;
if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();
return 0;
}

View File

@ -145,7 +145,12 @@ void CmdSketcherToggleConstruction::activated(int iMsg)
}
// finish the transaction and update
commitCommand();
updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
// clear the selection (convenience)
getSelection().clearSelection();

View File

@ -165,7 +165,14 @@ void openEditDatumDialog(Sketcher::SketchObject* sketch, int ConstrNbr)
catch (const Base::Exception& e) {
QMessageBox::critical(qApp->activeWindow(), QObject::tr("Dimensional constraint"), QString::fromUtf8(e.what()));
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
else
sketch->solve(); // we have to update the solver after this aborted addition.
}
}
}
@ -349,7 +356,13 @@ void SketcherGui::makeTangentToEllipseviaNewPoint(const Sketcher::SketchObject*
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
return;
}
@ -416,7 +429,13 @@ void SketcherGui::makeTangentToArcOfEllipseviaNewPoint(const Sketcher::SketchObj
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
return;
}
@ -1714,7 +1733,13 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
QObject::tr("Error"),
QString::fromLatin1(e.what()));
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
return;
}
@ -1865,7 +1890,13 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
return;
}
@ -2016,8 +2047,13 @@ void CmdSketcherConstrainTangent::activated(int iMsg)
QObject::tr("Error"),
QString::fromLatin1(e.what()));
Gui::Command::abortCommand();
Gui::Command::updateActive();
return;
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
return;
}
commitCommand();
@ -2414,7 +2450,14 @@ void CmdSketcherConstrainRadius::activated(int iMsg)
catch (const Base::Exception& e) {
QMessageBox::critical(qApp->activeWindow(), QObject::tr("Dimensional constraint"), QString::fromUtf8(e.what()));
abortCommand();
updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
else
Obj->solve(); // we have to update the solver after this aborted addition.
}
}
else {

View File

@ -2826,7 +2826,13 @@ private:
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
return;
}
@ -3243,7 +3249,13 @@ public:
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
return false;
}
@ -4857,7 +4869,11 @@ public:
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
}
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
@ -5097,8 +5113,14 @@ public:
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch
Gui::Command::updateActive();
}
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);

View File

@ -157,7 +157,11 @@ void CmdSketcherCloseShape::activated(int iMsg)
// finish the transaction and update
commitCommand();
updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
// clear the selection (convenience)
getSelection().clearSelection();
@ -239,7 +243,12 @@ void CmdSketcherConnect::activated(int iMsg)
// finish the transaction and update
commitCommand();
updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
// clear the selection (convenience)
getSelection().clearSelection();
@ -937,13 +946,23 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
}
Gui::Command::commitCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
Gui::Command::abortCommand();
Gui::Command::updateActive();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
if(autoRecompute)
Gui::Command::updateActive();
}
} // if(geo->getTypeId() == Part::GeomEllipse::getClassTypeId())

View File

@ -63,6 +63,9 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="Gui::PrefCheckBox" name="autoUpdate">
<property name="toolTip">
<string>Executes a recompute of the active document after every command</string>
</property>
<property name="text">
<string>Auto Update</string>
</property>
@ -79,6 +82,9 @@
</item>
<item>
<widget class="QPushButton" name="manualUpdate">
<property name="toolTip">
<string>Forces a recompute of the active document</string>
</property>
<property name="text">
<string>Update</string>
</property>