Fem: Update task dialog of the rigid body constraint

This commit is contained in:
marioalexis
2024-05-08 10:16:02 -03:00
committed by Chris Hennes
parent 03dc234970
commit 35db988ca0
3 changed files with 908 additions and 306 deletions

View File

@@ -67,45 +67,161 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
&QListWidget::itemClicked,
this,
&TaskFemConstraintRigidBody::setSelection);
// TODO: Relate inputs to property
connect(ui->cb_x_trans_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onTransModeXChanged);
connect(ui->cb_y_trans_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onTransModeYChanged);
connect(ui->cb_z_trans_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onTransModeZChanged);
connect(ui->cb_x_rot_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onRotModeXChanged);
connect(ui->cb_y_rot_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onRotModeYChanged);
connect(ui->cb_z_rot_mode,
qOverload<int>(&QComboBox::activated),
this,
&TaskFemConstraintRigidBody::onRotModeZChanged);
this->groupLayout()->addWidget(proxy);
/* Note: */
// Get the feature data
Fem::ConstraintRigidBody* pcConstraint =
static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject());
double fStates[15];
fStates[0] = pcConstraint->xRefNode.getValue();
fStates[1] = pcConstraint->yRefNode.getValue();
fStates[2] = pcConstraint->zRefNode.getValue();
fStates[3] = pcConstraint->xDisplacement.getValue();
fStates[4] = pcConstraint->yDisplacement.getValue();
fStates[5] = pcConstraint->zDisplacement.getValue();
fStates[6] = pcConstraint->xRotation.getValue();
fStates[7] = pcConstraint->yRotation.getValue();
fStates[8] = pcConstraint->zRotation.getValue();
fStates[9] = pcConstraint->xForce.getValue();
fStates[10] = pcConstraint->yForce.getValue();
fStates[11] = pcConstraint->zForce.getValue();
fStates[12] = pcConstraint->xMoment.getValue();
fStates[13] = pcConstraint->yMoment.getValue();
fStates[14] = pcConstraint->zMoment.getValue();
auto pcConstraint = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject());
const Base::Vector3d& refNode = pcConstraint->ReferenceNode.getValue();
const Base::Vector3d& disp = pcConstraint->Displacement.getValue();
Base::Vector3d rotDir;
double rotAngleRad;
pcConstraint->Rotation.getValue().getValue(rotDir, rotAngleRad);
Base::Quantity rotAngle(rotAngleRad, QString::fromUtf8("rad"));
Base::Quantity forceX = pcConstraint->ForceX.getQuantityValue();
Base::Quantity forceY = pcConstraint->ForceY.getQuantityValue();
Base::Quantity forceZ = pcConstraint->ForceZ.getQuantityValue();
Base::Quantity momentX = pcConstraint->MomentX.getQuantityValue();
Base::Quantity momentY = pcConstraint->MomentY.getQuantityValue();
Base::Quantity momentZ = pcConstraint->MomentZ.getQuantityValue();
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
// Fill data into dialog elements
ui->if_ref_node_x->setValue(fStates[0]);
ui->if_ref_node_y->setValue(fStates[1]);
ui->if_ref_node_z->setValue(fStates[2]);
ui->if_ref_force_x->setValue(fStates[9]);
ui->if_ref_force_y->setValue(fStates[10]);
ui->if_ref_force_z->setValue(fStates[11]);
ui->if_rot_force_x->setValue(fStates[12]);
ui->if_rot_force_y->setValue(fStates[13]);
ui->if_rot_force_z->setValue(fStates[14]);
ui->qsb_ref_node_x->setValue(refNode.x);
ui->qsb_ref_node_y->setValue(refNode.y);
ui->qsb_ref_node_z->setValue(refNode.z);
ui->qsb_ref_node_x->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("ReferenceNode.x")));
ui->qsb_ref_node_y->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("ReferenceNode.y")));
ui->qsb_ref_node_z->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("ReferenceNode.z")));
ui->qsb_ref_node_x->setMinimum(-FLOAT_MAX);
ui->qsb_ref_node_x->setMaximum(FLOAT_MAX);
ui->qsb_ref_node_y->setMinimum(-FLOAT_MAX);
ui->qsb_ref_node_y->setMaximum(FLOAT_MAX);
ui->qsb_ref_node_z->setMinimum(-FLOAT_MAX);
ui->qsb_ref_node_z->setMaximum(FLOAT_MAX);
ui->qsb_disp_x->setValue(disp.x);
ui->qsb_disp_y->setValue(disp.y);
ui->qsb_disp_z->setValue(disp.z);
ui->qsb_disp_x->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.x")));
ui->qsb_disp_y->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.y")));
ui->qsb_disp_z->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.z")));
ui->qsb_disp_x->setMinimum(-FLOAT_MAX);
ui->qsb_disp_x->setMaximum(FLOAT_MAX);
ui->qsb_disp_y->setMinimum(-FLOAT_MAX);
ui->qsb_disp_y->setMaximum(FLOAT_MAX);
ui->qsb_disp_z->setMinimum(-FLOAT_MAX);
ui->qsb_disp_z->setMaximum(FLOAT_MAX);
ui->spb_rot_axis_x->setValue(rotDir.x);
ui->spb_rot_axis_y->setValue(rotDir.y);
ui->spb_rot_axis_z->setValue(rotDir.z);
ui->qsb_rot_angle->setValue(rotAngle.getValueAs(Base::Quantity::Degree));
ui->spb_rot_axis_x->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Axis.x")));
ui->spb_rot_axis_y->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Axis.y")));
ui->spb_rot_axis_z->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Axis.z")));
ui->qsb_rot_angle->bind(
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Angle")));
ui->spb_rot_axis_x->setMinimum(-FLOAT_MAX);
ui->spb_rot_axis_x->setMaximum(FLOAT_MAX);
ui->spb_rot_axis_y->setMinimum(-FLOAT_MAX);
ui->spb_rot_axis_y->setMaximum(FLOAT_MAX);
ui->spb_rot_axis_z->setMinimum(-FLOAT_MAX);
ui->spb_rot_axis_z->setMaximum(FLOAT_MAX);
ui->qsb_rot_angle->setMinimum(-FLOAT_MAX);
ui->qsb_rot_angle->setMaximum(FLOAT_MAX);
ui->qsb_force_x->setValue(forceX);
ui->qsb_force_y->setValue(forceY);
ui->qsb_force_z->setValue(forceZ);
ui->qsb_force_x->bind(pcConstraint->ForceX);
ui->qsb_force_y->bind(pcConstraint->ForceY);
ui->qsb_force_z->bind(pcConstraint->ForceZ);
ui->qsb_force_x->setMinimum(-FLOAT_MAX);
ui->qsb_force_x->setMaximum(FLOAT_MAX);
ui->qsb_force_y->setMinimum(-FLOAT_MAX);
ui->qsb_force_y->setMaximum(FLOAT_MAX);
ui->qsb_force_z->setMinimum(-FLOAT_MAX);
ui->qsb_force_z->setMaximum(FLOAT_MAX);
ui->qsb_moment_x->setValue(momentX);
ui->qsb_moment_y->setValue(momentY);
ui->qsb_moment_z->setValue(momentZ);
ui->qsb_moment_x->bind(pcConstraint->MomentX);
ui->qsb_moment_y->bind(pcConstraint->MomentY);
ui->qsb_moment_z->bind(pcConstraint->MomentZ);
ui->qsb_moment_x->setMinimum(-FLOAT_MAX);
ui->qsb_moment_x->setMaximum(FLOAT_MAX);
ui->qsb_moment_y->setMinimum(-FLOAT_MAX);
ui->qsb_moment_y->setMaximum(FLOAT_MAX);
ui->qsb_moment_z->setMinimum(-FLOAT_MAX);
ui->qsb_moment_z->setMaximum(FLOAT_MAX);
QStringList modeList;
App::PropertyEnumeration* transMode = &pcConstraint->TranslationalModeX;
for (auto item : transMode->getEnumVector()) {
modeList << QString::fromUtf8(item.c_str());
}
ui->cb_x_trans_mode->addItems(modeList);
ui->cb_y_trans_mode->addItems(modeList);
ui->cb_z_trans_mode->addItems(modeList);
ui->cb_x_trans_mode->setCurrentIndex(pcConstraint->TranslationalModeX.getValue());
ui->cb_y_trans_mode->setCurrentIndex(pcConstraint->TranslationalModeY.getValue());
ui->cb_z_trans_mode->setCurrentIndex(pcConstraint->TranslationalModeZ.getValue());
modeList.clear();
App::PropertyEnumeration* rotMode = &pcConstraint->RotationalModeX;
for (auto item : rotMode->getEnumVector()) {
modeList << QString::fromUtf8(item.c_str());
}
ui->cb_x_rot_mode->addItems(modeList);
ui->cb_y_rot_mode->addItems(modeList);
ui->cb_z_rot_mode->addItems(modeList);
ui->cb_x_rot_mode->setCurrentIndex(pcConstraint->RotationalModeX.getValue());
ui->cb_y_rot_mode->setCurrentIndex(pcConstraint->RotationalModeY.getValue());
ui->cb_z_rot_mode->setCurrentIndex(pcConstraint->RotationalModeZ.getValue());
onTransModeXChanged(pcConstraint->TranslationalModeX.getValue());
onTransModeYChanged(pcConstraint->TranslationalModeY.getValue());
onTransModeZChanged(pcConstraint->TranslationalModeZ.getValue());
onRotModeXChanged(pcConstraint->RotationalModeX.getValue());
onRotModeYChanged(pcConstraint->RotationalModeY.getValue());
onRotModeZChanged(pcConstraint->RotationalModeZ.getValue());
ui->lw_references->clear();
for (std::size_t i = 0; i < Objects.size(); i++) {
@@ -274,6 +390,123 @@ void TaskFemConstraintRigidBody::onReferenceDeleted()
TaskFemConstraintRigidBody::removeFromSelection();
}
void TaskFemConstraintRigidBody::onRotModeXChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->RotationalModeX.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->spb_rot_axis_x->setEnabled(false);
ui->qsb_moment_x->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->spb_rot_axis_x->setEnabled(true);
ui->qsb_moment_x->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->spb_rot_axis_x->setEnabled(false);
ui->qsb_moment_x->setEnabled(true);
}
}
void TaskFemConstraintRigidBody::onRotModeYChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->RotationalModeY.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->spb_rot_axis_y->setEnabled(false);
ui->qsb_moment_y->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->spb_rot_axis_y->setEnabled(true);
ui->qsb_moment_y->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->spb_rot_axis_y->setEnabled(false);
ui->qsb_moment_y->setEnabled(true);
}
}
void TaskFemConstraintRigidBody::onRotModeZChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->RotationalModeZ.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->spb_rot_axis_z->setEnabled(false);
ui->qsb_moment_z->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->spb_rot_axis_z->setEnabled(true);
ui->qsb_moment_z->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->spb_rot_axis_z->setEnabled(false);
ui->qsb_moment_z->setEnabled(true);
}
}
void TaskFemConstraintRigidBody::onTransModeXChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->TranslationalModeX.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->qsb_disp_x->setEnabled(false);
ui->qsb_force_x->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->qsb_disp_x->setEnabled(true);
ui->qsb_force_x->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->qsb_disp_x->setEnabled(false);
ui->qsb_force_x->setEnabled(true);
}
}
void TaskFemConstraintRigidBody::onTransModeYChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->TranslationalModeY.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->qsb_disp_y->setEnabled(false);
ui->qsb_force_y->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->qsb_disp_y->setEnabled(true);
ui->qsb_force_y->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->qsb_disp_y->setEnabled(false);
ui->qsb_force_y->setEnabled(true);
}
}
void TaskFemConstraintRigidBody::onTransModeZChanged(int item)
{
const char* val = static_cast<Fem::ConstraintRigidBody*>(ConstraintView->getObject())
->TranslationalModeZ.getEnumVector()[item]
.c_str();
if (strcmp(val, "Free") == 0) {
ui->qsb_disp_z->setEnabled(false);
ui->qsb_force_z->setEnabled(false);
}
else if (strcmp(val, "Constraint") == 0) {
ui->qsb_disp_z->setEnabled(true);
ui->qsb_force_z->setEnabled(false);
}
else if (strcmp(val, "Load") == 0) {
ui->qsb_disp_z->setEnabled(false);
ui->qsb_force_z->setEnabled(true);
}
}
const std::string TaskFemConstraintRigidBody::getReferences() const
{
int rows = ui->lw_references->model()->rowCount();
@@ -284,46 +517,70 @@ const std::string TaskFemConstraintRigidBody::getReferences() const
return TaskFemConstraint::getReferences(items);
}
double TaskFemConstraintRigidBody::get_xRefNode() const
Base::Vector3d TaskFemConstraintRigidBody::getReferenceNode() const
{
return ui->if_ref_node_x->rawValue();
double x = ui->qsb_ref_node_x->rawValue();
double y = ui->qsb_ref_node_y->rawValue();
double z = ui->qsb_ref_node_z->rawValue();
return Base::Vector3d(x, y, z);
}
double TaskFemConstraintRigidBody::get_yRefNode() const
Base::Vector3d TaskFemConstraintRigidBody::getDisplacement() const
{
return ui->if_ref_node_y->rawValue();
double x = ui->qsb_disp_x->rawValue();
double y = ui->qsb_disp_y->rawValue();
double z = ui->qsb_disp_z->rawValue();
return Base::Vector3d(x, y, z);
}
double TaskFemConstraintRigidBody::get_zRefNode() const
Base::Rotation TaskFemConstraintRigidBody::getRotation() const
{
return ui->if_ref_node_z->rawValue();
double x = ui->spb_rot_axis_x->value();
double y = ui->spb_rot_axis_y->value();
double z = ui->spb_rot_axis_z->value();
double angle = ui->qsb_rot_angle->value().getValueAs(Base::Quantity::Radian);
return Base::Rotation(Base::Vector3d(x, y, z), angle);
}
double TaskFemConstraintRigidBody::get_xForce() const
std::vector<std::string> TaskFemConstraintRigidBody::getForce() const
{
return ui->if_ref_force_x->rawValue();
std::string x = ui->qsb_force_x->value().getSafeUserString().toStdString();
std::string y = ui->qsb_force_y->value().getSafeUserString().toStdString();
std::string z = ui->qsb_force_z->value().getSafeUserString().toStdString();
return {x, y, z};
}
double TaskFemConstraintRigidBody::get_yForce() const
std::vector<std::string> TaskFemConstraintRigidBody::getMoment() const
{
return ui->if_ref_force_y->rawValue();
std::string x = ui->qsb_moment_x->value().getSafeUserString().toStdString();
std::string y = ui->qsb_moment_y->value().getSafeUserString().toStdString();
std::string z = ui->qsb_moment_z->value().getSafeUserString().toStdString();
return std::vector<std::string>({x, y, z});
}
double TaskFemConstraintRigidBody::get_zForce() const
std::vector<std::string> TaskFemConstraintRigidBody::getTranslationalMode() const
{
return ui->if_ref_force_z->rawValue();
std::vector<std::string> transModes(3);
transModes[0] = ui->cb_x_trans_mode->currentText().toStdString();
transModes[1] = ui->cb_y_trans_mode->currentText().toStdString();
transModes[2] = ui->cb_z_trans_mode->currentText().toStdString();
return transModes;
}
double TaskFemConstraintRigidBody::get_xMoment() const
std::vector<std::string> TaskFemConstraintRigidBody::getRotationalMode() const
{
return ui->if_rot_force_x->rawValue();
}
double TaskFemConstraintRigidBody::get_yMoment() const
{
return ui->if_rot_force_y->rawValue();
}
double TaskFemConstraintRigidBody::get_zMoment() const
{
return ui->if_rot_force_z->rawValue();
}
// TODO: This needs to be implemented
bool TaskFemConstraintRigidBody::get_DefineRefNode() const
{
return true;
std::vector<std::string> rotModes(3);
rotModes[0] = ui->cb_x_rot_mode->currentText().toStdString();
rotModes[1] = ui->cb_y_rot_mode->currentText().toStdString();
rotModes[2] = ui->cb_z_rot_mode->currentText().toStdString();
return rotModes;
}
bool TaskFemConstraintRigidBody::event(QEvent* e)
@@ -381,52 +638,95 @@ bool TaskDlgFemConstraintRigidBody::accept()
const TaskFemConstraintRigidBody* parameters =
static_cast<const TaskFemConstraintRigidBody*>(parameter);
try {
Base::Vector3d ref = parameters->getReferenceNode();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.xRefNode = %f",
"App.ActiveDocument.%s.ReferenceNode = App.Vector(%f, %f, %f)",
name.c_str(),
parameters->get_xRefNode());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.yRefNode = %f",
name.c_str(),
parameters->get_yRefNode());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.zRefNode = %f",
name.c_str(),
parameters->get_zRefNode());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.xForce = %f",
name.c_str(),
parameters->get_xForce());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.yForce = %f",
name.c_str(),
parameters->get_yForce());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.zForce = %f",
name.c_str(),
parameters->get_zForce());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.xMoment = %f",
name.c_str(),
parameters->get_xMoment());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.yMoment = %f",
name.c_str(),
parameters->get_yMoment());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.zMoment = %f",
name.c_str(),
parameters->get_zMoment());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.DefineRefNode = %s",
name.c_str(),
parameters->get_DefineRefNode() ? "True" : "False");
ref.x,
ref.y,
ref.z);
Base::Vector3d disp = parameters->getDisplacement();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Displacement = App.Vector(%f, %f, %f)",
name.c_str(),
disp.x,
disp.y,
disp.z);
Base::Rotation rot = parameters->getRotation();
Base::Vector3d axis;
double angle;
rot.getValue(axis, angle);
Gui::Command::doCommand(
Gui::Command::Doc,
"App.ActiveDocument.%s.Rotation = App.Rotation(App.Vector(%f,% f, %f), Radian=%f)",
name.c_str(),
axis.x,
axis.y,
axis.z,
angle);
auto force = parameters->getForce();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.ForceX = \"%s\"",
name.c_str(),
force[0].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.ForceY = \"%s\"",
name.c_str(),
force[1].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.ForceZ = \"%s\"",
name.c_str(),
force[2].c_str());
auto moment = parameters->getMoment();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.MomentX = \"%s\"",
name.c_str(),
moment[0].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.MomentY = \"%s\"",
name.c_str(),
moment[1].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.MomentZ = \"%s\"",
name.c_str(),
moment[2].c_str());
auto transModes = parameters->getTranslationalMode();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.TranslationalModeX = \"%s\"",
name.c_str(),
transModes[0].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.TranslationalModeY = \"%s\"",
name.c_str(),
transModes[1].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.TranslationalModeZ = \"%s\"",
name.c_str(),
transModes[2].c_str());
auto rotModes = parameters->getRotationalMode();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.RotationalModeX = \"%s\"",
name.c_str(),
rotModes[0].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.RotationalModeY = \"%s\"",
name.c_str(),
rotModes[1].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.RotationalModeZ = \"%s\"",
name.c_str(),
rotModes[2].c_str());
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
parameters->getScale().c_str());
}
catch (const Base::Exception& e) {
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));

View File

@@ -41,22 +41,26 @@ public:
explicit TaskFemConstraintRigidBody(ViewProviderFemConstraintRigidBody* ConstraintView,
QWidget* parent = nullptr);
~TaskFemConstraintRigidBody() override;
const std::string getReferences() const override;
double get_xRefNode() const;
double get_yRefNode() const;
double get_zRefNode() const;
double get_xForce() const;
double get_yForce() const;
double get_zForce() const;
double get_xMoment() const;
double get_yMoment() const;
double get_zMoment() const;
bool get_DefineRefNode() const;
Base::Vector3d getReferenceNode() const;
Base::Vector3d getDisplacement() const;
Base::Rotation getRotation() const;
std::vector<std::string> getForce() const;
std::vector<std::string> getMoment() const;
std::vector<std::string> getTranslationalMode() const;
std::vector<std::string> getRotationalMode() const;
private Q_SLOTS:
void onReferenceDeleted();
void addToSelection() override;
void removeFromSelection() override;
void onTransModeXChanged(int);
void onTransModeYChanged(int);
void onTransModeZChanged(int);
void onRotModeXChanged(int);
void onRotModeYChanged(int);
void onRotModeZChanged(int);
protected:
bool event(QEvent* e) override;

View File

@@ -63,76 +63,92 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="lbl_ref_node">
<property name="text">
<widget class="QGroupBox" name="gpb_ref_mode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Reference Node</string>
</property>
<layout class="QFormLayout" name="f_layout_ref_node">
<item row="0" column="0">
<widget class="QLabel" name="lbl_ref_node_x">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_ref_node_x">
<property name="singleStep">
<double>1.0</double>
</property>
<property name="maximum">
<double>1000000000.0</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="value" stdset="0">
<double>0.0</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_ref_node_y">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_ref_node_y">
<property name="singleStep">
<double>1.0</double>
</property>
<property name="maximum">
<double>1000000000.0</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="value" stdset="0">
<double>0.0</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_ref_node_z">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_ref_node_z">
<property name="singleStep">
<double>1.0</double>
</property>
<property name="maximum">
<double>1000000000.0</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="value" stdset="0">
<double>0.0</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QFormLayout" name="f_layout_ref_node">
<item row="0" column="0">
<widget class="QLabel" name="lbl_ref_node_x">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::InputField" name="if_ref_node_x">
<property name="text">
<string>0 mm</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_ref_node_y">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::InputField" name="if_ref_node_y">
<property name="text">
<string>0 mm</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_ref_node_z">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::InputField" name="if_ref_node_z">
<property name="text">
<string>0 mm</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@@ -147,78 +163,211 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="lbl_ref_force">
<property name="text">
<string>Force on Reference Node</string>
<widget class="QGroupBox" name="gpb_trans_parameter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Translational Mode</string>
</property>
<layout class="QFormLayout" name="f_layout_trans_mode">
<item row="0" column="0">
<widget class="QLabel" name="lbl_trans_x_mode">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_trans_y_mode">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_trans_z_mode">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_x_trans_mode"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_y_trans_mode"/>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cb_z_trans_mode"/>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QFormLayout" name="f_layout_ref_force">
<item row="0" column="0">
<widget class="QLabel" name="lbl_ref_force_x">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::InputField" name="if_ref_force_x">
<property name="text">
<string>0 N</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_ref_force_y">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::InputField" name="if_ref_force_y">
<property name="text">
<string>0 N</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_ref_force_z">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::InputField" name="if_ref_force_z">
<property name="text">
<string>0 N</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
<widget class="QGroupBox" name="gpb_trans_disp">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Displacement</string>
</property>
<layout class="QFormLayout" name="f_layout_trans_disp">
<item row="0" column="0">
<widget class="QLabel" name="lbl_trans_x_disp">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_trans_y_disp">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_trans_z_disp">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_disp_x">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_disp_y">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_disp_z">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<widget class="QGroupBox" name="gpb_trans_force">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Force</string>
</property>
<layout class="QFormLayout" name="f_layout_trans_force">
<item row="0" column="0">
<widget class="QLabel" name="lbl_trans_x_force">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_trans_y_force">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_trans_z_force">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_force_x">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_force_y">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_force_z">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -231,75 +380,219 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="lbl_rot_force">
<property name="text">
<string>Moment on Rotation Node</string>
<widget class="QGroupBox" name="gpb_rot_mode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Rotational Mode</string>
</property>
<layout class="QFormLayout" name="f_layout_rot_mode">
<item row="0" column="0">
<widget class="QLabel" name="lbl_rot_x_mode">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_rot_y_mode">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_rot_z_mode">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_x_rot_mode"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_y_rot_mode"/>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cb_z_rot_mode"/>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QFormLayout" name="f_layout_rot_force">
<item row="0" column="0">
<widget class="QLabel" name="lbl_rot_force_x">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::InputField" name="if_rot_force_x">
<property name="text">
<string>0 N*m</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_rot_force_y">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::InputField" name="if_rot_force_y">
<property name="text">
<string>0 N*m</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_rot_force_z">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::InputField" name="if_rot_force_z">
<property name="text">
<string>0 N*m</string>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
<property name="quantity" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
<widget class="QGroupBox" name="gpb_rot_rot">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Rotation</string>
</property>
<layout class="QFormLayout" name="f_layout_rot_rot">
<item row="0" column="0">
<widget class="QLabel" name="lbl_rot_x_axis">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_rot_y_axis">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_rot_z_axis">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::DoubleSpinBox" name="spb_rot_axis_x">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>0.10000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::DoubleSpinBox" name="spb_rot_axis_y">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::DoubleSpinBox" name="spb_rot_axis_z">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbl_rot_angle">
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_rot_angle">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gpb_rot_moment">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Moment</string>
</property>
<layout class="QFormLayout" name="f_layout_rot_moment">
<item row="0" column="0">
<widget class="QLabel" name="lbl_rot_x_moment">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_rot_y_moment">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_rot_z_rot">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_moment_x">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_moment_y">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="qsb_moment_z">
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>1.00000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">N*m</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
@@ -307,9 +600,14 @@
</widget>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::DoubleSpinBox</class>
<extends>QWidget</extends>
<header>Gui/SpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>