Fem: Set Scale in TaskFemConstraint base class
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -563,11 +563,6 @@ bool TaskDlgFemConstraintContact::accept()
|
||||
"App.ActiveDocument.%s.StickSlope = \"%s\"",
|
||||
name.c_str(),
|
||||
parameterContact->getStickSlope().c_str());
|
||||
std::string scale = parameterContact->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -748,12 +748,6 @@ bool TaskDlgFemConstraintDisplacement::accept()
|
||||
name.c_str(),
|
||||
parameterDisplacement->get_useFlowSurfaceForce() ? "True"
|
||||
: "False");
|
||||
|
||||
std::string scale = parameterDisplacement->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -296,14 +296,6 @@ void TaskDlgFemConstraintFixed::open()
|
||||
|
||||
bool TaskDlgFemConstraintFixed::accept()
|
||||
{
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintFixed* parameters =
|
||||
static_cast<const TaskFemConstraintFixed*>(parameter);
|
||||
std::string scale = parameters->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
return TaskDlgFemConstraint::accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -1048,12 +1048,6 @@ bool TaskDlgFemConstraintFluidBoundary::accept()
|
||||
// Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %s",
|
||||
// name.c_str(), boundary->getReverse() ? "True" : "False");
|
||||
|
||||
std::string scale = boundary->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
|
||||
// solver specific setting, physical model selection
|
||||
const Fem::FemSolverObject* pcSolver = boundary->getFemSolver();
|
||||
|
||||
|
||||
@@ -476,12 +476,6 @@ bool TaskDlgFemConstraintForce::accept()
|
||||
"App.ActiveDocument.%s.Reversed = %s",
|
||||
name.c_str(),
|
||||
parameterForce->getReverse() ? "True" : "False");
|
||||
|
||||
scale = parameterForce->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -542,12 +542,6 @@ bool TaskDlgFemConstraintHeatflux::accept()
|
||||
"App.ActiveDocument.%s.Emissivity = %f",
|
||||
name.c_str(),
|
||||
parameterHeatflux->getEmissivity());
|
||||
|
||||
scale = parameterHeatflux->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -118,12 +118,6 @@ bool TaskDlgFemConstraintInitialTemperature::accept()
|
||||
"App.ActiveDocument.%s.initialTemperature = \"%s\"",
|
||||
name.c_str(),
|
||||
parameterTemperature->get_temperature().c_str());
|
||||
|
||||
std::string scale = parameterTemperature->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -322,14 +322,6 @@ void TaskDlgFemConstraintPlaneRotation::open()
|
||||
|
||||
bool TaskDlgFemConstraintPlaneRotation::accept()
|
||||
{
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintPlaneRotation* parameters =
|
||||
static_cast<const TaskFemConstraintPlaneRotation*>(parameter);
|
||||
std::string scale = parameters->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
return TaskDlgFemConstraint::accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -326,11 +326,6 @@ bool TaskDlgFemConstraintPressure::accept()
|
||||
"App.ActiveDocument.%s.Reversed = %s",
|
||||
name.c_str(),
|
||||
parameterPressure->getReverse() ? "True" : "False");
|
||||
std::string scale = parameterPressure->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -757,11 +757,6 @@ bool TaskDlgFemConstraintRigidBody::accept()
|
||||
"App.ActiveDocument.%s.RotationalModeZ = \"%s\"",
|
||||
name.c_str(),
|
||||
rotModes[2].c_str());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
parameters->getScale().c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -340,11 +340,6 @@ bool TaskDlgFemConstraintSpring::accept()
|
||||
"App.ActiveDocument.%s.ElmerStiffness = '%s'",
|
||||
name.c_str(),
|
||||
parameterStiffness->getElmerStiffness().c_str());
|
||||
std::string scale = parameterStiffness->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -399,11 +399,6 @@ bool TaskDlgFemConstraintTemperature::accept()
|
||||
name.c_str(),
|
||||
parameterTemperature->get_cflux().c_str());
|
||||
}
|
||||
std::string scale = parameterTemperature->getScale(); // OvG: determine modified scale
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str()); // OvG: implement modified scale
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -619,12 +619,6 @@ bool TaskDlgFemConstraintTransform::accept()
|
||||
"App.ActiveDocument.%s.TransformType = %s",
|
||||
name.c_str(),
|
||||
parameters->get_transform_type().c_str());
|
||||
|
||||
std::string scale = parameters->getScale();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Scale = %s",
|
||||
name.c_str(),
|
||||
scale.c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
Reference in New Issue
Block a user