Skip to content

Commit c71de92

Browse files
committed
Fem: Update ReferenceNode property from task dialog - fixes FreeCAD#14172
1 parent 0405022 commit c71de92

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
9191
qOverload<int>(&QComboBox::activated),
9292
this,
9393
&TaskFemConstraintRigidBody::onRotModeZChanged);
94+
connect(ui->qsb_ref_node_x,
95+
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
96+
this,
97+
&TaskFemConstraintRigidBody::onRefNodeXChanged);
98+
connect(ui->qsb_ref_node_y,
99+
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
100+
this,
101+
&TaskFemConstraintRigidBody::onRefNodeYChanged);
102+
connect(ui->qsb_ref_node_z,
103+
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
104+
this,
105+
&TaskFemConstraintRigidBody::onRefNodeZChanged);
94106

95107
this->groupLayout()->addWidget(proxy);
96108

@@ -506,6 +518,29 @@ void TaskFemConstraintRigidBody::onTransModeZChanged(int item)
506518
}
507519
}
508520

521+
void TaskFemConstraintRigidBody::onRefNodeXChanged(double value)
522+
{
523+
auto obj = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject());
524+
Base::Vector3d refNode = obj->ReferenceNode.getValue();
525+
refNode.x = value;
526+
obj->ReferenceNode.setValue(refNode);
527+
}
528+
529+
void TaskFemConstraintRigidBody::onRefNodeYChanged(double value)
530+
{
531+
auto obj = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject());
532+
Base::Vector3d refNode = obj->ReferenceNode.getValue();
533+
refNode.y = value;
534+
obj->ReferenceNode.setValue(refNode);
535+
}
536+
537+
void TaskFemConstraintRigidBody::onRefNodeZChanged(double value)
538+
{
539+
auto obj = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject());
540+
Base::Vector3d refNode = obj->ReferenceNode.getValue();
541+
refNode.z = value;
542+
obj->ReferenceNode.setValue(refNode);
543+
}
509544

510545
const std::string TaskFemConstraintRigidBody::getReferences() const
511546
{

src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ private Q_SLOTS:
6161
void onRotModeXChanged(int);
6262
void onRotModeYChanged(int);
6363
void onRotModeZChanged(int);
64+
void onRefNodeXChanged(double);
65+
void onRefNodeYChanged(double);
66+
void onRefNodeZChanged(double);
6467

6568
protected:
6669
bool event(QEvent* e) override;

0 commit comments

Comments
 (0)