+ FEM: cleanup of unused dialog
This commit is contained in:
parent
7ec585ec18
commit
ec96217335
|
@ -42,7 +42,6 @@ SOURCE_GROUP("Python" FILES ${Python_SRCS})
|
|||
|
||||
set(FemGui_MOC_HDRS
|
||||
DlgSettingsFemImp.h
|
||||
Hypothesis.h
|
||||
TaskObjectName.h
|
||||
TaskCreateNodeSet.h
|
||||
TaskDlgCreateNodeSet.h
|
||||
|
@ -63,7 +62,6 @@ SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS})
|
|||
|
||||
set(FemGui_UIC_SRCS
|
||||
DlgSettingsFem.ui
|
||||
Hypothesis.ui
|
||||
TaskCreateNodeSet.ui
|
||||
TaskObjectName.ui
|
||||
TaskFemConstraint.ui
|
||||
|
@ -81,9 +79,6 @@ SET(FemGui_DLG_SRCS
|
|||
DlgSettingsFem.ui
|
||||
DlgSettingsFemImp.cpp
|
||||
DlgSettingsFemImp.h
|
||||
Hypothesis.ui
|
||||
Hypothesis.cpp
|
||||
Hypothesis.h
|
||||
TaskFemConstraint.ui
|
||||
TaskFemConstraint.cpp
|
||||
TaskFemConstraint.h
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/FileDialog.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/SelectionFilter.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
|
@ -57,8 +58,6 @@
|
|||
#include <Mod/Fem/App/FemConstraint.h>
|
||||
#include <Mod/Fem/App/FemAnalysis.h>
|
||||
|
||||
|
||||
#include "Hypothesis.h"
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -142,10 +141,8 @@ bool CmdFemCreateAnalysis::isActive(void)
|
|||
return !FemGui::ActiveAnalysisObserver::instance()->hasActiveObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdFemAddPart);
|
||||
|
||||
CmdFemAddPart::CmdFemAddPart()
|
||||
|
@ -207,7 +204,6 @@ bool CmdFemAddPart::isActive(void)
|
|||
return Gui::Selection().countObjectsOfType(type) > 0;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdFemConstraintBearing);
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2012 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
#include "Hypothesis.h"
|
||||
#include "ui_Hypothesis.h"
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
HypothesisWidget::HypothesisWidget(QWidget* parent)
|
||||
: QWidget(parent), ui(new Ui_HypothesisWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
HypothesisWidget::~HypothesisWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool HypothesisWidget::accept()
|
||||
{
|
||||
Base::Type type = Base::Type::fromName("Part::Feature");
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(type);
|
||||
|
||||
Gui::Command::openCommand("Create FEM");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "import Fem");
|
||||
for (std::vector<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
QString cmd;
|
||||
QTextStream str(&cmd);
|
||||
App::Document* doc = (*it)->getDocument();
|
||||
QString doc_name = QString::fromAscii(doc->getName());
|
||||
QString obj_name = QString::fromAscii((*it)->getNameInDocument());
|
||||
str << QString::fromAscii(
|
||||
"__fem__=Fem.FemMesh()\n"
|
||||
"__fem__.setShape(FreeCAD.getDocument('%1').%2.Shape)\n")
|
||||
.arg(doc_name).arg(obj_name);
|
||||
int hyp=0;
|
||||
|
||||
if (ui->maxLength->isChecked()) {
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_MaxLength(%1,__fem__)\n"
|
||||
"hyp.setLength(%2)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++).arg(ui->valMaxLength->value());
|
||||
}
|
||||
|
||||
if (ui->localLength->isChecked()) {
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_LocalLength(%1,__fem__)\n"
|
||||
"hyp.setLength(%2)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++).arg(ui->valLocalLength->value());
|
||||
}
|
||||
|
||||
if (ui->maxArea->isChecked()) {
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_MaxElementArea(%1,__fem__)\n"
|
||||
"hyp.setMaxArea(%2)\n"
|
||||
"__fem__.addHypothesis(hyp)\n").
|
||||
arg(hyp++).arg(ui->valMaxArea->value());
|
||||
}
|
||||
#if 0
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_NumberOfSegments(%1,__fem__)\n"
|
||||
"hyp.setNumberOfSegments(1)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++);
|
||||
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_Deflection1D(%1,__fem__)\n"
|
||||
"hyp.setDeflection(0.02)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++);
|
||||
#endif
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_Regular_1D(%1,__fem__)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++);
|
||||
|
||||
if (ui->quadPref->isChecked()) {
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_QuadranglePreference(%1,__fem__)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++);
|
||||
}
|
||||
|
||||
str << QString::fromAscii(
|
||||
"hyp=Fem.StdMeshers_Quadrangle_2D(%1,__fem__)\n"
|
||||
"__fem__.addHypothesis(hyp)\n")
|
||||
.arg(hyp++);
|
||||
|
||||
str << QString::fromAscii(
|
||||
"__fem__.compute()\n"
|
||||
"FreeCAD.getDocument('%1').addObject"
|
||||
"(\"Fem::FemMeshObject\",'%2').FemMesh=__fem__\n"
|
||||
"del __fem__, hyp\n")
|
||||
.arg(doc_name).arg(obj_name);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "%s", (const char*)cmd.toAscii());
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HypothesisWidget::reject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void HypothesisWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
|
||||
TaskHypothesis::TaskHypothesis()
|
||||
{
|
||||
widget = new HypothesisWidget();
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskHypothesis::~TaskHypothesis()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskHypothesis::open()
|
||||
{
|
||||
}
|
||||
|
||||
bool TaskHypothesis::accept()
|
||||
{
|
||||
try {
|
||||
return widget->accept();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
catch (...) {
|
||||
Base::Console().Error("Unknown error\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool TaskHypothesis::reject()
|
||||
{
|
||||
return widget->reject();
|
||||
}
|
||||
|
||||
#include "moc_Hypothesis.cpp"
|
|
@ -1,75 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2012 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef FEMGUI_HYPOTHESIS_H
|
||||
#define FEMGUI_HYPOTHESIS_H
|
||||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
||||
namespace FemGui {
|
||||
|
||||
class Ui_HypothesisWidget;
|
||||
class HypothesisWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HypothesisWidget(QWidget* parent = 0);
|
||||
~HypothesisWidget();
|
||||
bool accept();
|
||||
bool reject();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui_HypothesisWidget* ui;
|
||||
};
|
||||
|
||||
class TaskHypothesis : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskHypothesis();
|
||||
~TaskHypothesis();
|
||||
|
||||
public:
|
||||
void open();
|
||||
bool accept();
|
||||
bool reject();
|
||||
|
||||
QDialogButtonBox::StandardButtons getStandardButtons() const
|
||||
{ return QDialogButtonBox::Ok | QDialogButtonBox::Cancel; }
|
||||
bool needsFullSpace() const
|
||||
{ return true; }
|
||||
|
||||
private:
|
||||
HypothesisWidget* widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
} //namespace FemGui
|
||||
|
||||
#endif // FEMGUI_HYPOTHESIS_H
|
|
@ -1,166 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FemGui::HypothesisWidget</class>
|
||||
<widget class="QWidget" name="FemGui::HypothesisWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>299</width>
|
||||
<height>238</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Hypothesis</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="quadPref">
|
||||
<property name="text">
|
||||
<string>Quadrangle</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="maxLength">
|
||||
<property name="text">
|
||||
<string>Maximum length</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="valMaxLength">
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="localLength">
|
||||
<property name="text">
|
||||
<string>Local length</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="valLocalLength">
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="maxArea">
|
||||
<property name="text">
|
||||
<string>Maximum element area</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="valMaxArea">
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>65</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>quadPref</tabstop>
|
||||
<tabstop>maxLength</tabstop>
|
||||
<tabstop>valMaxLength</tabstop>
|
||||
<tabstop>localLength</tabstop>
|
||||
<tabstop>valLocalLength</tabstop>
|
||||
<tabstop>maxArea</tabstop>
|
||||
<tabstop>valMaxArea</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>maxLength</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>valMaxLength</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>73</x>
|
||||
<y>92</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>172</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>localLength</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>valLocalLength</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>44</x>
|
||||
<y>116</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>186</x>
|
||||
<y>118</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>maxArea</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>valMaxArea</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>61</x>
|
||||
<y>144</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>197</x>
|
||||
<y>145</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user