From 0361543cfb41340afeec4b7336a2387c182e7955 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Thu, 20 Jun 2024 15:20:54 -0300 Subject: [PATCH] Fem: Set Scale in TaskFemConstraint base class --- src/Mod/Fem/Gui/TaskFemConstraint.cpp | 14 ++++++++------ src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 5 ----- src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp | 6 ------ src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 8 -------- src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp | 6 ------ src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 6 ------ src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp | 6 ------ .../Gui/TaskFemConstraintInitialTemperature.cpp | 6 ------ src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp | 8 -------- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 5 ----- src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp | 5 ----- src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp | 5 ----- src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp | 5 ----- src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp | 6 ------ 14 files changed, 8 insertions(+), 83 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index d59421b799..d8034cfc83 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -28,7 +28,6 @@ #include #include #include -#include // OvG conversion between string and int etc. #include #endif @@ -85,13 +84,11 @@ const std::string TaskFemConstraint::getReferences(const std::vector(ConstraintView->getObject()); - result = boost::lexical_cast(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()); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index d515c44438..50a9a548a5 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 7dc9a18368..6b16f103a2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 76c0bb1f76..3e70d70058 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -296,14 +296,6 @@ void TaskDlgFemConstraintFixed::open() bool TaskDlgFemConstraintFixed::accept() { - std::string name = ConstraintView->getObject()->getNameInDocument(); - const TaskFemConstraintFixed* parameters = - static_cast(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(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index 3410a64839..aafcd0f9de 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -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(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index 324fc7800d..5067504f1a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index 0044718932..ffd4447fc7 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp index 640b86cd32..c1d540025d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintInitialTemperature.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index a5419a4049..df3a5c40ae 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -322,14 +322,6 @@ void TaskDlgFemConstraintPlaneRotation::open() bool TaskDlgFemConstraintPlaneRotation::accept() { - std::string name = ConstraintView->getObject()->getNameInDocument(); - const TaskFemConstraintPlaneRotation* parameters = - static_cast(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(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 7cfe607d7f..b740f84eea 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp index 313c53d75b..faac62ae61 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp index 85eee0271a..15660ea917 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index 3ed30091e7..c17463acb6 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -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())); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index b669dee265..3a0de63305 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -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()));