From 6714af1bc8c6ba896bda33e832e9fd80bde767e2 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Mon, 20 May 2024 23:43:44 -0300 Subject: [PATCH] Fem: Update ReferenceNode property from task dialog - fixes #14172 --- .../Fem/Gui/TaskFemConstraintRigidBody.cpp | 35 +++++++++++++++++++ src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h | 3 ++ 2 files changed, 38 insertions(+) diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp index 596b0105af..313c53d75b 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp @@ -91,6 +91,18 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody( qOverload(&QComboBox::activated), this, &TaskFemConstraintRigidBody::onRotModeZChanged); + connect(ui->qsb_ref_node_x, + qOverload(&Gui::QuantitySpinBox::valueChanged), + this, + &TaskFemConstraintRigidBody::onRefNodeXChanged); + connect(ui->qsb_ref_node_y, + qOverload(&Gui::QuantitySpinBox::valueChanged), + this, + &TaskFemConstraintRigidBody::onRefNodeYChanged); + connect(ui->qsb_ref_node_z, + qOverload(&Gui::QuantitySpinBox::valueChanged), + this, + &TaskFemConstraintRigidBody::onRefNodeZChanged); this->groupLayout()->addWidget(proxy); @@ -506,6 +518,29 @@ void TaskFemConstraintRigidBody::onTransModeZChanged(int item) } } +void TaskFemConstraintRigidBody::onRefNodeXChanged(double value) +{ + auto obj = static_cast(ConstraintView->getObject()); + Base::Vector3d refNode = obj->ReferenceNode.getValue(); + refNode.x = value; + obj->ReferenceNode.setValue(refNode); +} + +void TaskFemConstraintRigidBody::onRefNodeYChanged(double value) +{ + auto obj = static_cast(ConstraintView->getObject()); + Base::Vector3d refNode = obj->ReferenceNode.getValue(); + refNode.y = value; + obj->ReferenceNode.setValue(refNode); +} + +void TaskFemConstraintRigidBody::onRefNodeZChanged(double value) +{ + auto obj = static_cast(ConstraintView->getObject()); + Base::Vector3d refNode = obj->ReferenceNode.getValue(); + refNode.z = value; + obj->ReferenceNode.setValue(refNode); +} const std::string TaskFemConstraintRigidBody::getReferences() const { diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h index fc03f5b7eb..dde1cad77a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h @@ -61,6 +61,9 @@ private Q_SLOTS: void onRotModeXChanged(int); void onRotModeYChanged(int); void onRotModeZChanged(int); + void onRefNodeXChanged(double); + void onRefNodeYChanged(double); + void onRefNodeZChanged(double); protected: bool event(QEvent* e) override;