diff --git a/src/Mod/Fem/App/FemConstraintForce.cpp b/src/Mod/Fem/App/FemConstraintForce.cpp index f3e5bf4bfa..cca87225e6 100644 --- a/src/Mod/Fem/App/FemConstraintForce.cpp +++ b/src/Mod/Fem/App/FemConstraintForce.cpp @@ -82,6 +82,10 @@ void ConstraintForce::onChanged(const App::Property* prop) direction = -direction; DirectionVector.setValue(direction); } else if (prop == &Reversed) { + // if the direction is invalid try to compute it again + if (naturalDirectionVector.Length() < Precision::Confusion()) { + naturalDirectionVector = getDirection(Direction); + } if (naturalDirectionVector.Length() >= Precision::Confusion()) { if (Reversed.getValue() && (DirectionVector.getValue() == naturalDirectionVector)) { DirectionVector.setValue(-naturalDirectionVector); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index 47f38de96e..655a11d473 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -329,6 +329,15 @@ TaskDlgFemConstraintForce::TaskDlgFemConstraintForce(ViewProviderFemConstraintFo //==== calls from the TaskView =============================================================== +void TaskDlgFemConstraintForce::open() +{ + // a transaction is already open at creation time of the panel + if (!Gui::Command::hasPendingCommand()) { + QString msg = QObject::tr("Constraint force"); + Gui::Command::openCommand((const char*)msg.toUtf8()); + } +} + bool TaskDlgFemConstraintForce::accept() { std::string name = ConstraintView->getObject()->getNameInDocument(); @@ -360,4 +369,14 @@ bool TaskDlgFemConstraintForce::accept() return TaskDlgFemConstraint::accept(); } +bool TaskDlgFemConstraintForce::reject() +{ + // roll back the changes + Gui::Command::abortCommand(); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + Gui::Command::updateActive(); + + return true; +} + #include "moc_TaskFemConstraintForce.cpp" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.h b/src/Mod/Fem/Gui/TaskFemConstraintForce.h index 5da5923609..c49b3afbdf 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.h @@ -83,7 +83,9 @@ public: TaskDlgFemConstraintForce(ViewProviderFemConstraintForce *ConstraintView); /// is called by the framework if the dialog is accepted (Ok) + virtual void open(); virtual bool accept(); + virtual bool reject(); };