Skip to content

Commit

Permalink
FEM: Make connections with rigid body gui and app
Browse files Browse the repository at this point in the history
  • Loading branch information
AjinkyaDahale committed Nov 5, 2022
1 parent a8f3624 commit 3b62cf1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ const std::string TaskFemConstraintRigidBody::getReferences() const
return TaskFemConstraint::getReferences(items);
}

double TaskFemConstraintRigidBody::get_xRefNode() const { return ui->if_ref_node_x->rawValue(); }
double TaskFemConstraintRigidBody::get_yRefNode() const { return ui->if_ref_node_y->rawValue(); }
double TaskFemConstraintRigidBody::get_zRefNode() const { return ui->if_ref_node_z->rawValue(); }
double TaskFemConstraintRigidBody::get_xLoad() const { return ui->if_ref_load_x->rawValue(); }
double TaskFemConstraintRigidBody::get_yLoad() const { return ui->if_ref_load_y->rawValue(); }
double TaskFemConstraintRigidBody::get_zLoad() const { return ui->if_ref_load_z->rawValue(); }
double TaskFemConstraintRigidBody::get_xMoment() const { return ui->if_rot_load_x->rawValue(); }
double TaskFemConstraintRigidBody::get_yMoment() const { return ui->if_rot_load_y->rawValue(); }
double TaskFemConstraintRigidBody::get_zMoment() const { return ui->if_rot_load_z->rawValue(); }
// TODO: This needs to be implemented
bool TaskFemConstraintRigidBody::get_DefineRefNode() const { return true; }

bool TaskFemConstraintRigidBody::event(QEvent* e)
{
return TaskFemConstraint::KeyEvent(e);
Expand Down Expand Up @@ -293,8 +305,25 @@ bool TaskDlgFemConstraintRigidBody::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
const TaskFemConstraintRigidBody* parameters = static_cast<const TaskFemConstraintRigidBody*>(parameter);
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
try {
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.xRefNode = %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.xLoad = %f", name.c_str(), parameters->get_xLoad());
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.yLoad = %f", name.c_str(), parameters->get_yLoad());
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.zLoad = %f", name.c_str(), parameters->get_zLoad());
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");

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
}
catch (const Base::Exception& e) {
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
return false;
}
return TaskDlgFemConstraint::accept();
}

Expand Down
10 changes: 10 additions & 0 deletions src/Mod/Fem/Gui/TaskFemConstraintRigidBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class TaskFemConstraintRigidBody : public TaskFemConstraintOnBoundary
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_xLoad() const;
double get_yLoad() const;
double get_zLoad() const;
double get_xMoment() const;
double get_yMoment() const;
double get_zMoment() const;
bool get_DefineRefNode() const;

private Q_SLOTS:
void onReferenceDeleted();
Expand Down

0 comments on commit 3b62cf1

Please sign in to comment.