Merge pull request #14926 from marioalexis84/fem-clean_task_constraint

Fem: Clean up TaskFemConstraint* classes
This commit is contained in:
Chris Hennes
2024-07-01 11:30:18 -05:00
committed by GitHub
31 changed files with 31 additions and 450 deletions

View File

@@ -28,7 +28,6 @@
#include <QKeyEvent>
#include <QListWidget>
#include <QMessageBox>
#include <boost/lexical_cast.hpp> // OvG conversion between string and int etc.
#include <sstream>
#endif
@@ -82,13 +81,11 @@ const std::string TaskFemConstraint::getReferences(const std::vector<std::string
return result;
}
const std::string
TaskFemConstraint::getScale() const // OvG: Return pre-calculated scale for constraint display
const std::string TaskFemConstraint::getScale() const
{
std::string result;
Fem::Constraint* pcConstraint = static_cast<Fem::Constraint*>(ConstraintView->getObject());
result = boost::lexical_cast<std::string>(pcConstraint->Scale.getValue());
return result;
return std::to_string(pcConstraint->Scale.getValue());
}
void TaskFemConstraint::setSelection(QListWidgetItem* item)
@@ -195,12 +192,11 @@ bool TaskFemConstraint::KeyEvent(QEvent* e)
void TaskDlgFemConstraint::open()
{
ConstraintView->setVisible(true);
Gui::Command::runCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
if (!Gui::Command::hasPendingCommand()) {
const char* typeName = ConstraintView->getObject()->getTypeId().getName();
Gui::Command::openCommand(typeName);
ConstraintView->setVisible(true);
}
}
bool TaskDlgFemConstraint::accept()
@@ -223,6 +219,11 @@ bool TaskDlgFemConstraint::accept()
return false;
}
std::string scale = parameter->getScale();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Scale = %s",
name.c_str(),
scale.c_str());
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
if (!ConstraintView->getObject()->isValid()) {
throw Base::RuntimeError(ConstraintView->getObject()->getStatusString());
@@ -243,9 +244,9 @@ bool TaskDlgFemConstraint::reject()
// roll back the changes
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraint.cpp"

View File

@@ -520,21 +520,6 @@ TaskDlgFemConstraintContact::TaskDlgFemConstraintContact(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintContact::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Contact constraint");
Gui::Command::openCommand(static_cast<const char*>(msg.toUtf8()));
ConstraintView->setVisible(true);
Gui::Command::runCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintContact::accept()
{
/* Note: */
@@ -563,11 +548,6 @@ bool TaskDlgFemConstraintContact::accept()
"App.ActiveDocument.%s.StickSlope = \"%s\"",
name.c_str(),
parameterContact->getStickSlope().c_str());
std::string scale = parameterContact->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()));
@@ -577,12 +557,4 @@ bool TaskDlgFemConstraintContact::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintContact::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintContact.cpp"

View File

@@ -75,9 +75,7 @@ class TaskDlgFemConstraintContact: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintContact(ViewProviderFemConstraintContact* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -34,6 +34,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintDisplacement.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintDisplacement.h"
#include "ui_TaskFemConstraintDisplacement.h"
@@ -625,21 +626,6 @@ TaskDlgFemConstraintDisplacement::TaskDlgFemConstraintDisplacement(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintDisplacement::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Displacement boundary condition");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintDisplacement::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -748,12 +734,6 @@ bool TaskDlgFemConstraintDisplacement::accept()
name.c_str(),
parameterDisplacement->get_useFlowSurfaceForce() ? "True"
: "False");
std::string scale = parameterDisplacement->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()));
@@ -763,13 +743,4 @@ bool TaskDlgFemConstraintDisplacement::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintDisplacement::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintDisplacement.cpp"

View File

@@ -113,9 +113,7 @@ class TaskDlgFemConstraintDisplacement: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintDisplacement(
ViewProviderFemConstraintDisplacement* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -33,6 +33,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintFixed.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintFixed.h"
#include "ui_TaskFemConstraintFixed.h"
@@ -279,41 +280,9 @@ TaskDlgFemConstraintFixed::TaskDlgFemConstraintFixed(ViewProviderFemConstraintFi
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintFixed::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Fixed boundary condition");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintFixed::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
const TaskFemConstraintFixed* parameters =
static_cast<const TaskFemConstraintFixed*>(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
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintFixed::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintFixed.cpp"

View File

@@ -66,9 +66,7 @@ class TaskDlgFemConstraintFixed: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintFixed(ViewProviderFemConstraintFixed* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -44,6 +44,7 @@
#include <Mod/Fem/App/FemMeshObject.h>
#include <Mod/Fem/App/FemSolverObject.h>
#include <Mod/Fem/App/FemTools.h>
#include <Mod/Part/App/PartFeature.h>
#include "ActiveAnalysisObserver.h"
#include "TaskFemConstraintFluidBoundary.h"
@@ -994,15 +995,6 @@ TaskDlgFemConstraintFluidBoundary::TaskDlgFemConstraintFluidBoundary(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintFluidBoundary::open()
{
// a transaction is already open when creating this panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Fluid boundary condition");
Gui::Command::openCommand((const char*)msg.toUtf8());
}
}
bool TaskDlgFemConstraintFluidBoundary::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -1048,12 +1040,6 @@ bool TaskDlgFemConstraintFluidBoundary::accept()
// Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %s",
// name.c_str(), boundary->getReverse() ? "True" : "False");
std::string scale = boundary->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
// solver specific setting, physical model selection
const Fem::FemSolverObject* pcSolver = boundary->getFemSolver();
@@ -1115,13 +1101,4 @@ bool TaskDlgFemConstraintFluidBoundary::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintFluidBoundary::reject()
{
Gui::Command::abortCommand(); // recover properties content
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintFluidBoundary.cpp"

View File

@@ -120,9 +120,7 @@ public:
ViewProviderFemConstraintFluidBoundary* ConstraintView);
/// is called by the framework if the dialog is accepted (Ok)
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -37,6 +37,7 @@
#include <Gui/ViewProvider.h>
#include <Mod/Fem/App/FemConstraintForce.h>
#include <Mod/Fem/App/FemTools.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintForce.h"
#include "ui_TaskFemConstraintForce.h"
@@ -426,21 +427,6 @@ TaskDlgFemConstraintForce::TaskDlgFemConstraintForce(ViewProviderFemConstraintFo
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintForce::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Force load");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintForce::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -476,12 +462,6 @@ bool TaskDlgFemConstraintForce::accept()
"App.ActiveDocument.%s.Reversed = %s",
name.c_str(),
parameterForce->getReverse() ? "True" : "False");
scale = parameterForce->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()));
@@ -491,14 +471,4 @@ bool TaskDlgFemConstraintForce::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintForce::reject()
{
// roll back the changes
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintForce.cpp"

View File

@@ -91,9 +91,7 @@ public:
explicit TaskDlgFemConstraintForce(ViewProviderFemConstraintForce* ConstraintView);
/// is called by the framework if the dialog is accepted (Ok)
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -34,6 +34,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintHeatflux.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintHeatflux.h"
#include "ui_TaskFemConstraintHeatflux.h"
@@ -504,21 +505,6 @@ TaskDlgFemConstraintHeatflux::TaskDlgFemConstraintHeatflux(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintHeatflux::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Heat flux load");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintHeatflux::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -531,23 +517,14 @@ bool TaskDlgFemConstraintHeatflux::accept()
"App.ActiveDocument.%s.AmbientTemp = %f",
name.c_str(),
parameterHeatflux->getAmbientTemp());
/*Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.FaceTemp = %f",
name.c_str(), parameterHeatflux->getFaceTemp());*/
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.FilmCoef = %f",
name.c_str(),
parameterHeatflux->getFilmCoef());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Emissivity = %f",
name.c_str(),
parameterHeatflux->getEmissivity());
scale = parameterHeatflux->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()));
@@ -557,13 +534,4 @@ bool TaskDlgFemConstraintHeatflux::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintHeatflux::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintHeatflux.cpp"

View File

@@ -81,9 +81,7 @@ class TaskDlgFemConstraintHeatflux: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintHeatflux(ViewProviderFemConstraintHeatflux* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -92,20 +92,6 @@ TaskDlgFemConstraintInitialTemperature::TaskDlgFemConstraintInitialTemperature(
}
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintInitialTemperature::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Constraint initial temperature");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintInitialTemperature::accept()
{
@@ -118,19 +104,6 @@ bool TaskDlgFemConstraintInitialTemperature::accept()
"App.ActiveDocument.%s.initialTemperature = \"%s\"",
name.c_str(),
parameterTemperature->get_temperature().c_str());
std::string scale = parameterTemperature->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;
}
try {
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
if (!ConstraintView->getObject()->isValid()) {
throw Base::RuntimeError(ConstraintView->getObject()->getStatusString());
@@ -146,13 +119,4 @@ bool TaskDlgFemConstraintInitialTemperature::accept()
return true;
}
bool TaskDlgFemConstraintInitialTemperature::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintInitialTemperature.cpp"

View File

@@ -62,9 +62,7 @@ class TaskDlgFemConstraintInitialTemperature: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintInitialTemperature(
ViewProviderFemConstraintInitialTemperature* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -305,41 +305,9 @@ TaskDlgFemConstraintPlaneRotation::TaskDlgFemConstraintPlaneRotation(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintPlaneRotation::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Plane multi-point constraint");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintPlaneRotation::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
const TaskFemConstraintPlaneRotation* parameters =
static_cast<const TaskFemConstraintPlaneRotation*>(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
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintPlaneRotation::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintPlaneRotation.cpp"

View File

@@ -68,9 +68,7 @@ class TaskDlgFemConstraintPlaneRotation: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintPlaneRotation(
ViewProviderFemConstraintPlaneRotation* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -32,6 +32,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintPressure.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintPressure.h"
#include "ui_TaskFemConstraintPressure.h"
@@ -295,21 +296,6 @@ TaskDlgFemConstraintPressure::TaskDlgFemConstraintPressure(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintPressure::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Pressure load");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintPressure::accept()
{
/* Note: */
@@ -326,11 +312,6 @@ bool TaskDlgFemConstraintPressure::accept()
"App.ActiveDocument.%s.Reversed = %s",
name.c_str(),
parameterPressure->getReverse() ? "True" : "False");
std::string scale = parameterPressure->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()));
@@ -340,13 +321,4 @@ bool TaskDlgFemConstraintPressure::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintPressure::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintPressure.cpp"

View File

@@ -71,9 +71,7 @@ class TaskDlgFemConstraintPressure: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintPressure(ViewProviderFemConstraintPressure* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -194,21 +194,6 @@ TaskDlgFemConstraintPulley::TaskDlgFemConstraintPulley(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintPulley::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Constraint pulley");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintPulley::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();

View File

@@ -64,7 +64,6 @@ public:
/// is called by the framework if the dialog is accepted (Ok)
bool accept() override;
void open() override;
};
} // namespace FemGui

View File

@@ -32,6 +32,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintRigidBody.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintRigidBody.h"
#include "ui_TaskFemConstraintRigidBody.h"
@@ -652,21 +653,6 @@ TaskDlgFemConstraintRigidBody::TaskDlgFemConstraintRigidBody(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintRigidBody::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Constraint RigidBody");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintRigidBody::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -757,11 +743,6 @@ bool TaskDlgFemConstraintRigidBody::accept()
"App.ActiveDocument.%s.RotationalModeZ = \"%s\"",
name.c_str(),
rotModes[2].c_str());
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Scale = %s",
name.c_str(),
parameters->getScale().c_str());
}
catch (const Base::Exception& e) {
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
@@ -770,13 +751,4 @@ bool TaskDlgFemConstraintRigidBody::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintRigidBody::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintRigidBody.cpp"

View File

@@ -81,9 +81,7 @@ class TaskDlgFemConstraintRigidBody: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintRigidBody(ViewProviderFemConstraintRigidBody* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -33,6 +33,7 @@
#include <Gui/Command.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintSpring.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintSpring.h"
#include "ui_TaskFemConstraintSpring.h"
@@ -303,21 +304,6 @@ TaskDlgFemConstraintSpring::TaskDlgFemConstraintSpring(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintSpring::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Constraint spring");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintSpring::accept()
{
/* Note: */
@@ -340,11 +326,6 @@ bool TaskDlgFemConstraintSpring::accept()
"App.ActiveDocument.%s.ElmerStiffness = '%s'",
name.c_str(),
parameterStiffness->getElmerStiffness().c_str());
std::string scale = parameterStiffness->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()));
@@ -354,13 +335,4 @@ bool TaskDlgFemConstraintSpring::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintSpring::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintSpring.cpp"

View File

@@ -69,9 +69,7 @@ class TaskDlgFemConstraintSpring: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintSpring(ViewProviderFemConstraintSpring* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -36,6 +36,7 @@
#include <Gui/QuantitySpinBox.h>
#include <Gui/SelectionObject.h>
#include <Mod/Fem/App/FemConstraintTemperature.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskFemConstraintTemperature.h"
#include "ui_TaskFemConstraintTemperature.h"
@@ -359,21 +360,6 @@ TaskDlgFemConstraintTemperature::TaskDlgFemConstraintTemperature(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintTemperature::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Temperature boundary condition");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintTemperature::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
@@ -399,11 +385,6 @@ bool TaskDlgFemConstraintTemperature::accept()
name.c_str(),
parameterTemperature->get_cflux().c_str());
}
std::string scale = parameterTemperature->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()));
@@ -413,13 +394,4 @@ bool TaskDlgFemConstraintTemperature::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintTemperature::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintTemperature.cpp"

View File

@@ -77,9 +77,7 @@ class TaskDlgFemConstraintTemperature: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintTemperature(ViewProviderFemConstraintTemperature* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -579,21 +579,6 @@ TaskDlgFemConstraintTransform::TaskDlgFemConstraintTransform(
//==== calls from the TaskView ===============================================================
void TaskDlgFemConstraintTransform::open()
{
// a transaction is already open at creation time of the panel
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Local coordinate system");
Gui::Command::openCommand((const char*)msg.toUtf8());
ConstraintView->setVisible(true);
Gui::Command::doCommand(
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str()); // OvG: Hide meshes and show parts
}
}
bool TaskDlgFemConstraintTransform::accept()
{
/* Note: */
@@ -619,12 +604,6 @@ bool TaskDlgFemConstraintTransform::accept()
"App.ActiveDocument.%s.TransformType = %s",
name.c_str(),
parameters->get_transform_type().c_str());
std::string scale = parameters->getScale();
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Scale = %s",
name.c_str(),
scale.c_str());
}
catch (const Base::Exception& e) {
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));
@@ -634,13 +613,4 @@ bool TaskDlgFemConstraintTransform::accept()
return TaskDlgFemConstraint::accept();
}
bool TaskDlgFemConstraintTransform::reject()
{
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::updateActive();
return true;
}
#include "moc_TaskFemConstraintTransform.cpp"

View File

@@ -78,9 +78,7 @@ class TaskDlgFemConstraintTransform: public TaskDlgFemConstraint
public:
explicit TaskDlgFemConstraintTransform(ViewProviderFemConstraintTransform* ConstraintView);
void open() override;
bool accept() override;
bool reject() override;
};
} // namespace FemGui

View File

@@ -23,8 +23,9 @@
#include "PreCompiled.h"
#include "Mod/Fem/App/FemConstraint.h"
#include <Gui/Application.h>
#include "Mod/Fem/App/FemConstraint.h"
#include <Mod/Part/App/PartFeature.h>
#include <Mod/Part/Gui/ReferenceHighlighter.h>
#include <Mod/Part/Gui/ViewProvider.h>

View File

@@ -24,10 +24,14 @@
#ifndef GUI_VIEWPROVIDERFEMCONSTRAINTONBOUNDARY_H
#define GUI_VIEWPROVIDERFEMCONSTRAINTONBOUNDARY_H
#include <Mod/Part/App/PartFeature.h>
#include "ViewProviderFemConstraint.h"
namespace Part
{
class Feature;
}
namespace FemGui
{