Fem: Enable expression for the spring constraint task panel
This commit is contained in:
committed by
Chris Hennes
parent
40531158f2
commit
d94c65ba3f
@@ -77,30 +77,22 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->if_norm->setUnit(pcConstraint->NormalStiffness.getUnit());
|
||||
ui->if_norm->setMinimum(
|
||||
0); // TODO fix this -------------------------------------------------------------------
|
||||
ui->if_norm->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity ns =
|
||||
Base::Quantity((pcConstraint->NormalStiffness.getValue()), Base::Unit::Stiffness);
|
||||
ui->if_norm->setValue(ns);
|
||||
ui->qsb_norm->setUnit(pcConstraint->NormalStiffness.getUnit());
|
||||
ui->qsb_norm->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_norm->setValue(pcConstraint->NormalStiffness.getQuantityValue());
|
||||
|
||||
ui->if_tan->setUnit(pcConstraint->TangentialStiffness.getUnit());
|
||||
ui->if_tan->setMinimum(
|
||||
0); // TODO fix this -------------------------------------------------------------------
|
||||
ui->if_tan->setMaximum(FLOAT_MAX);
|
||||
Base::Quantity ts =
|
||||
Base::Quantity((pcConstraint->TangentialStiffness.getValue()), Base::Unit::Stiffness);
|
||||
ui->if_tan->setValue(ts);
|
||||
ui->qsb_tan->setUnit(pcConstraint->TangentialStiffness.getUnit());
|
||||
ui->qsb_tan->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_tan->setValue(pcConstraint->TangentialStiffness.getQuantityValue());
|
||||
|
||||
ui->ElmerStiffnessCB->clear();
|
||||
ui->cb_elmer_stiffness->clear();
|
||||
auto stiffnesses = pcConstraint->ElmerStiffness.getEnumVector();
|
||||
QStringList stiffnessesList;
|
||||
for (auto item : stiffnesses) {
|
||||
stiffnessesList << QLatin1String(item.c_str());
|
||||
}
|
||||
ui->ElmerStiffnessCB->addItems(stiffnessesList);
|
||||
ui->ElmerStiffnessCB->setCurrentIndex(pcConstraint->ElmerStiffness.getValue());
|
||||
ui->cb_elmer_stiffness->addItems(stiffnessesList);
|
||||
ui->cb_elmer_stiffness->setCurrentIndex(pcConstraint->ElmerStiffness.getValue());
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
@@ -114,6 +106,9 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
|
||||
buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd);
|
||||
buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove);
|
||||
|
||||
ui->qsb_norm->bind(pcConstraint->NormalStiffness);
|
||||
ui->qsb_tan->bind(pcConstraint->TangentialStiffness);
|
||||
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -255,19 +250,19 @@ const std::string TaskFemConstraintSpring::getReferences() const
|
||||
return TaskFemConstraint::getReferences(items);
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintSpring::get_normalStiffness() const
|
||||
std::string TaskFemConstraintSpring::getNormalStiffness() const
|
||||
{
|
||||
return ui->if_norm->value().getSafeUserString().toStdString();
|
||||
return ui->qsb_norm->value().getSafeUserString().toStdString();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintSpring::get_tangentialStiffness() const
|
||||
std::string TaskFemConstraintSpring::getTangentialStiffness() const
|
||||
{
|
||||
return ui->if_tan->value().getSafeUserString().toStdString();
|
||||
return ui->qsb_tan->value().getSafeUserString().toStdString();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintSpring::getElmerStiffness() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->ElmerStiffnessCB->currentText());
|
||||
return Base::Tools::toStdString(ui->cb_elmer_stiffness->currentText());
|
||||
}
|
||||
|
||||
void TaskFemConstraintSpring::changeEvent(QEvent*)
|
||||
@@ -312,11 +307,11 @@ bool TaskDlgFemConstraintSpring::accept()
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.NormalStiffness = \"%s\"",
|
||||
name.c_str(),
|
||||
parameterStiffness->get_normalStiffness().c_str());
|
||||
parameterStiffness->getNormalStiffness().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.TangentialStiffness = \"%s\"",
|
||||
name.c_str(),
|
||||
parameterStiffness->get_tangentialStiffness().c_str());
|
||||
parameterStiffness->getTangentialStiffness().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ElmerStiffness = '%s'",
|
||||
name.c_str(),
|
||||
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
QWidget* parent = nullptr);
|
||||
~TaskFemConstraintSpring() override;
|
||||
const std::string getReferences() const override;
|
||||
std::string get_normalStiffness() const;
|
||||
std::string get_tangentialStiffness() const;
|
||||
std::string getNormalStiffness() const;
|
||||
std::string getTangentialStiffness() const;
|
||||
std::string getElmerStiffness() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
@@ -69,8 +69,25 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_norm">
|
||||
<property name="text">
|
||||
<string>Normal Stiffness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_norm">
|
||||
<property name="unit" stdset="0">
|
||||
<string>N/m</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_tan">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -82,36 +99,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="if_tan">
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_tan">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
<string>N/m</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>Normal Stiffness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="if_norm">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Stiffness for Elmer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="ElmerStiffnessCB">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cb_elmer_stiffness">
|
||||
<property name="toolTip">
|
||||
<string>What stiffness should be
|
||||
used for the Elmer solver</string>
|
||||
|
||||
Reference in New Issue
Block a user