Merge pull request #20059 from marioalexis84/fem-heat_flux
Fem: Change from radio buttons to combo box to reduce space in heat flux task panel
This commit is contained in:
@@ -684,6 +684,7 @@ void CmdFemConstraintHeatflux::activated(int)
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().addObject(\"Fem::ConstraintHeatflux\",\"%s\")",
|
||||
FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.ConstraintType = \"DFlux\"", FeatName.c_str());
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.AmbientTemp = 300.0",
|
||||
FeatName.c_str()); // OvG: set default not equal to 0
|
||||
|
||||
@@ -61,11 +61,10 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
&QAction::triggered,
|
||||
this,
|
||||
&TaskFemConstraintHeatflux::onReferenceDeleted);
|
||||
|
||||
connect(ui->rb_convection, &QRadioButton::clicked, this, &TaskFemConstraintHeatflux::Conv);
|
||||
connect(ui->rb_radiation, &QRadioButton::clicked, this, &TaskFemConstraintHeatflux::Rad);
|
||||
connect(ui->rb_dflux, &QRadioButton::clicked, this, &TaskFemConstraintHeatflux::Flux);
|
||||
|
||||
connect(ui->cb_constr_type,
|
||||
qOverload<int>(&QComboBox::activated),
|
||||
this,
|
||||
&TaskFemConstraintHeatflux::onConstrTypeChanged);
|
||||
connect(ui->qsb_heat_flux,
|
||||
qOverload<double>(&QuantitySpinBox::valueChanged),
|
||||
this,
|
||||
@@ -105,11 +104,20 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
ui->btnRemove->blockSignals(true);
|
||||
|
||||
// Get the feature data
|
||||
Fem::ConstraintHeatflux* pcConstraint = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
auto pcConstraint = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
// Fill data into dialog elements
|
||||
App::PropertyEnumeration* constrType = &pcConstraint->ConstraintType;
|
||||
QStringList qTypeList;
|
||||
for (auto item : constrType->getEnumVector()) {
|
||||
qTypeList << QString::fromUtf8(item.c_str());
|
||||
}
|
||||
ui->cb_constr_type->addItems(qTypeList);
|
||||
ui->cb_constr_type->setCurrentIndex(constrType->getValue());
|
||||
ui->sw_heatflux->setCurrentIndex(constrType->getValue());
|
||||
|
||||
ui->qsb_ambienttemp_conv->setMinimum(0);
|
||||
ui->qsb_ambienttemp_conv->setMaximum(FLOAT_MAX);
|
||||
|
||||
@@ -130,21 +138,6 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
|
||||
ui->qsb_heat_flux->setValue(pcConstraint->DFlux.getQuantityValue());
|
||||
|
||||
std::string constraint_type = pcConstraint->ConstraintType.getValueAsString();
|
||||
|
||||
if (constraint_type == "Convection") {
|
||||
ui->rb_convection->setChecked(true);
|
||||
ui->sw_heatflux->setCurrentIndex(0);
|
||||
}
|
||||
else if (constraint_type == "Radiation") {
|
||||
ui->rb_radiation->setChecked(true);
|
||||
ui->sw_heatflux->setCurrentIndex(1);
|
||||
}
|
||||
else if (constraint_type == "DFlux") {
|
||||
ui->rb_dflux->setChecked(true);
|
||||
ui->sw_heatflux->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
|
||||
@@ -216,12 +209,12 @@ void TaskFemConstraintHeatflux::Conv()
|
||||
Fem::ConstraintHeatflux* pcConstraint = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ConstraintType = %s",
|
||||
"App.ActiveDocument.%s.ConstraintType = \"%s\"",
|
||||
name.c_str(),
|
||||
get_constraint_type().c_str());
|
||||
getConstraintType().c_str());
|
||||
ui->qsb_ambienttemp_conv->setValue(pcConstraint->AmbientTemp.getQuantityValue());
|
||||
ui->qsb_film_coef->setValue(pcConstraint->FilmCoef.getQuantityValue());
|
||||
ui->sw_heatflux->setCurrentIndex(0);
|
||||
ui->sw_heatflux->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void TaskFemConstraintHeatflux::Rad()
|
||||
@@ -229,12 +222,12 @@ void TaskFemConstraintHeatflux::Rad()
|
||||
Fem::ConstraintHeatflux* pcConstraint = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ConstraintType = %s",
|
||||
"App.ActiveDocument.%s.ConstraintType = \"%s\"",
|
||||
name.c_str(),
|
||||
get_constraint_type().c_str());
|
||||
getConstraintType().c_str());
|
||||
ui->qsb_ambienttemp_rad->setValue(pcConstraint->AmbientTemp.getQuantityValue());
|
||||
ui->dsb_emissivity->setValue(pcConstraint->Emissivity.getValue());
|
||||
ui->sw_heatflux->setCurrentIndex(1);
|
||||
ui->sw_heatflux->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
void TaskFemConstraintHeatflux::Flux()
|
||||
@@ -242,11 +235,27 @@ void TaskFemConstraintHeatflux::Flux()
|
||||
Fem::ConstraintHeatflux* pcConstraint = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ConstraintType = %s",
|
||||
"App.ActiveDocument.%s.ConstraintType = \"%s\"",
|
||||
name.c_str(),
|
||||
get_constraint_type().c_str());
|
||||
getConstraintType().c_str());
|
||||
ui->qsb_heat_flux->setValue(pcConstraint->DFlux.getQuantityValue());
|
||||
ui->sw_heatflux->setCurrentIndex(2);
|
||||
ui->sw_heatflux->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void TaskFemConstraintHeatflux::onConstrTypeChanged(int item)
|
||||
{
|
||||
auto obj = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
obj->ConstraintType.setValue(item);
|
||||
const char* type = obj->ConstraintType.getValueAsString();
|
||||
if (strcmp(type, "DFlux") == 0) {
|
||||
this->Flux();
|
||||
}
|
||||
else if (strcmp(type, "Convection") == 0) {
|
||||
this->Conv();
|
||||
}
|
||||
else if (strcmp(type, "Radiation") == 0) {
|
||||
this->Rad();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskFemConstraintHeatflux::addToSelection()
|
||||
@@ -401,14 +410,17 @@ const std::string TaskFemConstraintHeatflux::getReferences() const
|
||||
|
||||
std::string TaskFemConstraintHeatflux::getAmbientTemp() const
|
||||
{
|
||||
if (ui->rb_convection->isChecked()) {
|
||||
std::string type = this->getConstraintType();
|
||||
if (type == "Convection") {
|
||||
return ui->qsb_ambienttemp_conv->value().getSafeUserString();
|
||||
}
|
||||
if (ui->rb_radiation->isChecked()) {
|
||||
else if (type == "Convection") {
|
||||
return ui->qsb_ambienttemp_rad->value().getSafeUserString();
|
||||
}
|
||||
auto obj = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
return obj->AmbientTemp.getQuantityValue().getSafeUserString();
|
||||
else {
|
||||
auto obj = ConstraintView->getObject<Fem::ConstraintHeatflux>();
|
||||
return obj->AmbientTemp.getQuantityValue().getSafeUserString();
|
||||
}
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintHeatflux::getFilmCoef() const
|
||||
@@ -426,19 +438,9 @@ double TaskFemConstraintHeatflux::getEmissivity() const
|
||||
return ui->dsb_emissivity->value();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintHeatflux::get_constraint_type() const
|
||||
std::string TaskFemConstraintHeatflux::getConstraintType() const
|
||||
{
|
||||
std::string type;
|
||||
if (ui->rb_convection->isChecked()) {
|
||||
type = "\"Convection\"";
|
||||
}
|
||||
else if (ui->rb_radiation->isChecked()) {
|
||||
type = "\"Radiation\"";
|
||||
}
|
||||
else if (ui->rb_dflux->isChecked()) {
|
||||
type = "\"DFlux\"";
|
||||
}
|
||||
return type;
|
||||
return ui->cb_constr_type->currentText().toStdString();
|
||||
}
|
||||
|
||||
void TaskFemConstraintHeatflux::changeEvent(QEvent* e)
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
std::string getFilmCoef() const;
|
||||
std::string getDFlux() const;
|
||||
double getEmissivity() const;
|
||||
std::string get_constraint_type() const;
|
||||
std::string getConstraintType() const;
|
||||
const std::string getReferences() const override;
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -60,6 +60,7 @@ private Q_SLOTS:
|
||||
void onFilmCoefChanged(double val);
|
||||
void onEmissivityChanged(double val);
|
||||
void onHeatFluxChanged(double val);
|
||||
void onConstrTypeChanged(int val);
|
||||
void Conv();
|
||||
void Rad();
|
||||
void Flux();
|
||||
|
||||
@@ -63,90 +63,55 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_convection">
|
||||
<property name="text">
|
||||
<string>Surface Convection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_radiation">
|
||||
<property name="text">
|
||||
<string>Surface Radiation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_dflux">
|
||||
<property name="text">
|
||||
<string>Surface heat flux</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_constr_type">
|
||||
<property name="text">
|
||||
<string>Constraint Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cb_constr_type"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="sw_heatflux">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<widget class="QWidget" name="page_0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutFilmCoef">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_filmcoef">
|
||||
<property name="text">
|
||||
<string>Film Coefficient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_film_coef">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">W/m^2/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_heat_flux">
|
||||
<property name="text">
|
||||
<string>Surface Heat Flux</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutAmbientTempCov">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_ambienttemp_conv">
|
||||
<property name="text">
|
||||
<string>Ambient Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_ambienttemp_conv">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>300.0000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_heat_flux">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">W/m^2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -156,59 +121,57 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutEmissivity">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_emissivity">
|
||||
<property name="text">
|
||||
<string>Emissivity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::DoubleSpinBox" name="dsb_emissivity">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_filmcoef">
|
||||
<property name="text">
|
||||
<string>Film Coefficient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutAmbientTempRad">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_ambienttemp_rad">
|
||||
<property name="text">
|
||||
<string>Ambient Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_ambienttemp_rad">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>300.0000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_film_coef">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">W/m^2/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_ambienttemp_conv">
|
||||
<property name="text">
|
||||
<string>Ambient Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_ambienttemp_conv">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>300.0000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -218,30 +181,58 @@
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_heat_flux">
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_emissivity">
|
||||
<property name="text">
|
||||
<string>Surface Heat Flux</string>
|
||||
<string>Emissivity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_heat_flux">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">W/m^2</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::DoubleSpinBox" name="dsb_emissivity">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_ambienttemp_rad">
|
||||
<property name="text">
|
||||
<string>Ambient Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_ambienttemp_rad">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>300.0000000000000</double>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -253,11 +244,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
|
||||
Reference in New Issue
Block a user