[FEM] task dialogs: remove unused includes
- also some code style fixes from MSVC
This commit is contained in:
@@ -27,46 +27,29 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <BRepAdaptor_Curve.hxx>
|
||||
# include <BRepAdaptor_Surface.hxx>
|
||||
# include <Geom_Line.hxx>
|
||||
# include <Geom_Plane.hxx>
|
||||
# include <Precision.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <gp_Ax1.hxx>
|
||||
# include <gp_Lin.hxx>
|
||||
# include <gp_Pln.hxx>
|
||||
# include <QAction>
|
||||
# include <QKeyEvent>
|
||||
# include <QMessageBox>
|
||||
# include <QRegExp>
|
||||
# include <QTextStream>
|
||||
|
||||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include "Mod/Fem/App/FemConstraintTransform.h"
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Mod/Fem/App/FemConstraintTransform.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include "TaskFemConstraintTransform.h"
|
||||
#include "ui_TaskFemConstraintTransform.h"
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/SelectionFilter.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Fem/App/FemTools.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
using namespace FemGui;
|
||||
using namespace Gui;
|
||||
|
||||
/* TRANSLATOR FemGui::TaskFemConstraintTransform */
|
||||
|
||||
TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraintTransform *ConstraintView,QWidget *parent)
|
||||
: TaskFemConstraint(ConstraintView, parent, "FEM_ConstraintTransform")
|
||||
TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraintTransform* ConstraintView, QWidget* parent)
|
||||
: TaskFemConstraint(ConstraintView, parent, "FEM_ConstraintTransform")
|
||||
{
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskFemConstraintTransform();
|
||||
@@ -78,7 +61,7 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint
|
||||
deleteAction->connect(deleteAction, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
|
||||
|
||||
// highlight seletcted list items in the model
|
||||
connect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
connect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
connect(ui->lw_Rect, SIGNAL(itemClicked(QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
@@ -89,8 +72,8 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
connect(ui->rb_rect, SIGNAL(clicked(bool)), this, SLOT(Rect()));
|
||||
connect(ui->rb_cylin, SIGNAL(clicked(bool)), this, SLOT(Cyl()));
|
||||
connect(ui->rb_rect, SIGNAL(clicked(bool)), this, SLOT(Rect()));
|
||||
connect(ui->rb_cylin, SIGNAL(clicked(bool)), this, SLOT(Cyl()));
|
||||
|
||||
connect(ui->sp_X, SIGNAL(valueChanged(int)), this, SLOT(x_Changed(int)));
|
||||
connect(ui->sp_Y, SIGNAL(valueChanged(int)), this, SLOT(y_Changed(int)));
|
||||
@@ -111,7 +94,8 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint
|
||||
ui->sw_transform->setCurrentIndex(0);
|
||||
ui->rb_rect->setChecked(1);
|
||||
ui->rb_cylin->setChecked(0);
|
||||
} else if (transform_type == "Cylindrical") {
|
||||
}
|
||||
else if (transform_type == "Cylindrical") {
|
||||
ui->sw_transform->setCurrentIndex(1);
|
||||
ui->rb_rect->setChecked(0);
|
||||
ui->rb_cylin->setChecked(1);
|
||||
@@ -120,7 +104,7 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint
|
||||
ui->lw_Rect->clear();
|
||||
|
||||
//Transformable surfaces
|
||||
Gui::Command::doCommand(Gui::Command::Doc,TaskFemConstraintTransform::getSurfaceReferences((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, TaskFemConstraintTransform::getSurfaceReferences((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str());
|
||||
std::vector<App::DocumentObject*> ObjDispl = pcConstraint->RefDispl.getValues();
|
||||
std::vector<std::string> SubElemDispl = pcConstraint->RefDispl.getSubValues();
|
||||
|
||||
@@ -143,17 +127,17 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint
|
||||
int p = 0;
|
||||
for (std::size_t i = 0; i < ObjDispl.size(); i++) {
|
||||
for (std::size_t j = 0; j < Objects.size(); j++) {
|
||||
if ((makeRefText(ObjDispl[i], SubElemDispl[i]))==(makeRefText(Objects[j], SubElements[j]))){
|
||||
if ((makeRefText(ObjDispl[i], SubElemDispl[i])) == (makeRefText(Objects[j], SubElements[j]))) {
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Selection buttons
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
|
||||
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
|
||||
|
||||
updateUI();
|
||||
if ((p==0) && (Objects.size() > 0)) {
|
||||
if ((p == 0) && (Objects.size() > 0)) {
|
||||
QMessageBox::warning(this, tr("Constraint update error"), tr("The transformable faces have changed. Please add only the transformable faces and remove non-transformable faces!"));
|
||||
return;
|
||||
}
|
||||
@@ -178,43 +162,43 @@ void TaskFemConstraintTransform::updateUI()
|
||||
}
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::x_Changed(int i){
|
||||
void TaskFemConstraintTransform::x_Changed(int i) {
|
||||
Fem::ConstraintTransform* pcConstraint = static_cast<Fem::ConstraintTransform*>(ConstraintView->getObject());
|
||||
double x = i;
|
||||
pcConstraint->X_rot.setValue(x);
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.X_rot = %f", name.c_str(), x);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.X_rot = %f", name.c_str(), x);
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
pcConstraint->References.setValues(Objects, SubElements);
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::y_Changed(int i){
|
||||
void TaskFemConstraintTransform::y_Changed(int i) {
|
||||
Fem::ConstraintTransform* pcConstraint = static_cast<Fem::ConstraintTransform*>(ConstraintView->getObject());
|
||||
double y = i;
|
||||
pcConstraint->Y_rot.setValue(y);
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Y_rot = %f", name.c_str(), y);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Y_rot = %f", name.c_str(), y);
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
pcConstraint->References.setValues(Objects, SubElements);
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::z_Changed(int i){
|
||||
void TaskFemConstraintTransform::z_Changed(int i) {
|
||||
Fem::ConstraintTransform* pcConstraint = static_cast<Fem::ConstraintTransform*>(ConstraintView->getObject());
|
||||
double z = i;
|
||||
pcConstraint->Z_rot.setValue(z);
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Z_rot = %f", name.c_str(), z);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Z_rot = %f", name.c_str(), z);
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
pcConstraint->References.setValues(Objects,SubElements);
|
||||
pcConstraint->References.setValues(Objects, SubElements);
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::Rect(){
|
||||
void TaskFemConstraintTransform::Rect() {
|
||||
ui->sw_transform->setCurrentIndex(0);
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.TransformType = %s",name.c_str(), get_transform_type().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.TransformType = %s", name.c_str(), get_transform_type().c_str());
|
||||
Fem::ConstraintTransform* pcConstraint = static_cast<Fem::ConstraintTransform*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
if (Objects.size() > 0) {
|
||||
@@ -223,13 +207,13 @@ void TaskFemConstraintTransform::Rect(){
|
||||
}
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::Cyl(){
|
||||
void TaskFemConstraintTransform::Cyl() {
|
||||
ui->sw_transform->setCurrentIndex(1);
|
||||
ui->sp_X->setValue(0);
|
||||
ui->sp_Y->setValue(0);
|
||||
ui->sp_Z->setValue(0);
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.TransformType = %s",name.c_str(), get_transform_type().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.TransformType = %s", name.c_str(), get_transform_type().c_str());
|
||||
Fem::ConstraintTransform* pcConstraint = static_cast<Fem::ConstraintTransform*>(ConstraintView->getObject());
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
if (Objects.size() > 0) {
|
||||
@@ -243,18 +227,18 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
{
|
||||
int rows = ui->lw_Rect->model()->rowCount();
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
|
||||
if (selection.size() == 0){
|
||||
if (selection.size() == 0) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows==1){
|
||||
if (rows == 1) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one face for rectangular transform constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rows==0) && (selection.size()>=2)){
|
||||
if ((rows == 0) && (selection.size() >= 2)) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one face for rectangular transform constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
@@ -266,20 +250,20 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
|
||||
std::vector<App::DocumentObject*> ObjDispl = pcConstraint->RefDispl.getValues();
|
||||
std::vector<std::string> SubElemDispl = pcConstraint->RefDispl.getSubValues();
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it) {//for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
if (subNames.size() != 1){
|
||||
if (subNames.size() != 1) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only one face for transform constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt){// for every selected sub element
|
||||
bool addMe=true;
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
@@ -295,27 +279,27 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr, SubElements.end(), subNames[subIt]))
|
||||
for (std::vector<std::string>::iterator itr = std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr, SubElements.end(), subNames[subIt]))
|
||||
{// for every sub element in selection that matches one in old list
|
||||
if (obj == Objects[std::distance(SubElements.begin(),itr)]){//if selected sub element's object equals the one in old list then it was added before so don't add
|
||||
if (obj == Objects[std::distance(SubElements.begin(), itr)]) {//if selected sub element's object equals the one in old list then it was added before so don't add
|
||||
addMe = false;
|
||||
}
|
||||
}
|
||||
if (addMe){
|
||||
disconnect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
if (addMe) {
|
||||
disconnect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
for (std::size_t i = 0; i < ObjDispl.size(); i++) {
|
||||
if ((makeRefText(ObjDispl[i], SubElemDispl[i])) == (makeRefText(obj, subNames[subIt]))){
|
||||
if ((makeRefText(ObjDispl[i], SubElemDispl[i])) == (makeRefText(obj, subNames[subIt]))) {
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_Rect->addItem(makeRefText(obj, subNames[subIt]));
|
||||
connect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
connect(ui->lw_Rect, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
|
||||
this, SLOT(setSelection(QListWidgetItem*)));
|
||||
}
|
||||
}
|
||||
if (Objects.size() == 0){
|
||||
if (Objects.size() == 0) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only transformable faces can be selected! Apply displacement constraint to surface first then apply constraint to surface"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
@@ -363,7 +347,7 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
void TaskFemConstraintTransform::removeFromSelection()
|
||||
{
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
|
||||
if (selection.size() == 0){
|
||||
if (selection.size() == 0) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
|
||||
return;
|
||||
}
|
||||
@@ -371,7 +355,7 @@ void TaskFemConstraintTransform::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it) {//for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
@@ -379,19 +363,19 @@ void TaskFemConstraintTransform::removeFromSelection()
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt){// for every selected sub element
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr = std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr, SubElements.end(), subNames[subIt]))
|
||||
{// for every sub element in selection that matches one in old list
|
||||
if (obj == Objects[std::distance(SubElements.begin(), itr)]){//if selected sub element's object equals the one in old list then it was added before so mark for deletion
|
||||
if (obj == Objects[std::distance(SubElements.begin(), itr)]) {//if selected sub element's object equals the one in old list then it was added before so mark for deletion
|
||||
itemsToDel.push_back(std::distance(SubElements.begin(), itr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::sort(itemsToDel.begin(), itemsToDel.end());
|
||||
while (itemsToDel.size() > 0){
|
||||
while (itemsToDel.size() > 0) {
|
||||
Objects.erase(Objects.begin() + itemsToDel.back());
|
||||
SubElements.erase(SubElements.begin() + itemsToDel.back());
|
||||
itemsToDel.pop_back();
|
||||
@@ -422,14 +406,14 @@ void TaskFemConstraintTransform::onReferenceDeleted() {
|
||||
TaskFemConstraintTransform::removeFromSelection();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintTransform::getSurfaceReferences(std::string showConstr="")
|
||||
std::string TaskFemConstraintTransform::getSurfaceReferences(std::string showConstr = "")
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=18&t=43650
|
||||
{
|
||||
return "\n\
|
||||
doc = FreeCAD.ActiveDocument\n\
|
||||
for obj in doc.Objects:\n\
|
||||
if obj.isDerivedFrom(\"Fem::FemAnalysis\"):\n\
|
||||
if doc."+showConstr+" in obj.Group:\n\
|
||||
if doc." + showConstr + " in obj.Group:\n\
|
||||
analysis = obj\n\
|
||||
A = []\n\
|
||||
i = 0\n\
|
||||
@@ -450,41 +434,42 @@ for member in analysis.Group:\n\
|
||||
ss.append(member)\n\
|
||||
i = i+1\n\
|
||||
if i>0:\n\
|
||||
doc."+showConstr+".RefDispl = [x]\n\
|
||||
doc."+showConstr+".NameDispl = ss\n\
|
||||
doc." + showConstr + ".RefDispl = [x]\n\
|
||||
doc." + showConstr + ".NameDispl = ss\n\
|
||||
else:\n\
|
||||
doc."+showConstr+".RefDispl = None\n\
|
||||
doc."+showConstr+".NameDispl = []\n";
|
||||
doc." + showConstr + ".RefDispl = None\n\
|
||||
doc." + showConstr + ".NameDispl = []\n";
|
||||
}
|
||||
|
||||
/* Note: */
|
||||
double TaskFemConstraintTransform::get_X_rot() const{return ui->sp_X->value();}
|
||||
double TaskFemConstraintTransform::get_Y_rot() const{return ui->sp_Y->value();}
|
||||
double TaskFemConstraintTransform::get_Z_rot() const{return ui->sp_Z->value();}
|
||||
double TaskFemConstraintTransform::get_X_rot() const { return ui->sp_X->value(); }
|
||||
double TaskFemConstraintTransform::get_Y_rot() const { return ui->sp_Y->value(); }
|
||||
double TaskFemConstraintTransform::get_Z_rot() const { return ui->sp_Z->value(); }
|
||||
|
||||
std::string TaskFemConstraintTransform::get_transform_type(void) const {
|
||||
std::string transform;
|
||||
if (ui->rb_rect->isChecked()) {
|
||||
transform = "\"Rectangular\"";
|
||||
} else if (ui->rb_cylin->isChecked()) {
|
||||
}
|
||||
else if (ui->rb_cylin->isChecked()) {
|
||||
transform = "\"Cylindrical\"";
|
||||
}
|
||||
return transform;
|
||||
}
|
||||
|
||||
bool TaskFemConstraintTransform::event(QEvent *e)
|
||||
bool TaskFemConstraintTransform::event(QEvent* e)
|
||||
{
|
||||
return TaskFemConstraint::KeyEvent(e);
|
||||
}
|
||||
|
||||
void TaskFemConstraintTransform::changeEvent(QEvent *){
|
||||
void TaskFemConstraintTransform::changeEvent(QEvent*) {
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// TaskDialog
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TaskDlgFemConstraintTransform::TaskDlgFemConstraintTransform(ViewProviderFemConstraintTransform *ConstraintView)
|
||||
TaskDlgFemConstraintTransform::TaskDlgFemConstraintTransform(ViewProviderFemConstraintTransform* ConstraintView)
|
||||
{
|
||||
this->ConstraintView = ConstraintView;
|
||||
assert(ConstraintView);
|
||||
@@ -502,41 +487,41 @@ void TaskDlgFemConstraintTransform::open()
|
||||
QString msg = QObject::tr("Constraint transform");
|
||||
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
|
||||
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: */
|
||||
/* Note: */
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
const TaskFemConstraintTransform* parameters = static_cast<const TaskFemConstraintTransform*>(parameter);
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.X_rot = %f",
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.X_rot = %f",
|
||||
name.c_str(), parameters->get_X_rot());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Y_rot = %f",
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Y_rot = %f",
|
||||
name.c_str(), parameters->get_Y_rot());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Z_rot = %f",
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Z_rot = %f",
|
||||
name.c_str(), parameters->get_Z_rot());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.TransformType = %s",
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.TransformType = %s",
|
||||
name.c_str(), parameters->get_transform_type().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
|
||||
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();
|
||||
}
|
||||
|
||||
bool TaskDlgFemConstraintTransform::reject()
|
||||
{
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user