Fem: Set Scale in TaskFemConstraint base class

This commit is contained in:
marioalexis
2024-06-20 15:20:54 -03:00
parent 7aa7b741ea
commit 0361543cfb
14 changed files with 8 additions and 83 deletions

View File

@@ -28,7 +28,6 @@
#include <QKeyEvent>
#include <QListWidget>
#include <QMessageBox>
#include <boost/lexical_cast.hpp> // OvG conversion between string and int etc.
#include <sstream>
#endif
@@ -85,13 +84,11 @@ const std::string TaskFemConstraint::getReferences(const std::vector<std::string
return result;
}
const std::string
TaskFemConstraint::getScale() const // OvG: Return pre-calculated scale for constraint display
const std::string TaskFemConstraint::getScale() const
{
std::string result;
Fem::Constraint* pcConstraint = static_cast<Fem::Constraint*>(ConstraintView->getObject());
result = boost::lexical_cast<std::string>(pcConstraint->Scale.getValue());
return result;
return std::to_string(pcConstraint->Scale.getValue());
}
void TaskFemConstraint::setSelection(QListWidgetItem* item)
@@ -226,6 +223,11 @@ bool TaskDlgFemConstraint::accept()
return false;
}
std::string scale = parameter->getScale();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Scale = %s",
name.c_str(),
scale.c_str());
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
if (!ConstraintView->getObject()->isValid()) {
throw Base::RuntimeError(ConstraintView->getObject()->getStatusString());