From 02396c352ff13de74bb8e3387db0001c955a7216 Mon Sep 17 00:00:00 2001 From: kgoao Date: Tue, 28 Feb 2017 11:50:17 +0100 Subject: [PATCH] FEM: 1DFlow, gui command --- src/Mod/Fem/App/CMakeLists.txt | 1 + src/Mod/Fem/CMakeLists.txt | 1 + src/Mod/Fem/Gui/Workbench.cpp | 2 + src/Mod/Fem/InitGui.py | 1 + src/Mod/Fem/PyGui/_CommandFluidSection.py | 53 +++++++++++++++++++++++ 5 files changed, 58 insertions(+) create mode 100644 src/Mod/Fem/PyGui/_CommandFluidSection.py diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 991e10a9fb..17aca2d389 100644 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -110,6 +110,7 @@ SET(FemGuiScripts_SRCS PyGui/_CommandControlSolver.py PyGui/_CommandConstraintSelfWeight.py PyGui/_CommandFEMMesh2Mesh.py + PyGui/_CommandFluidSection.py PyGui/_CommandMaterialMechanicalNonlinear.py PyGui/_CommandMaterialSolid.py PyGui/_CommandMaterialFluid.py diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 061d8cb945..353dcbc46b 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -71,6 +71,7 @@ INSTALL( PyGui/_CommandControlSolver.py PyGui/_CommandConstraintSelfWeight.py PyGui/_CommandFEMMesh2Mesh.py + PyGui/_CommandFluidSection.py PyGui/_CommandMaterialMechanicalNonlinear.py PyGui/_CommandMaterialSolid.py PyGui/_CommandMaterialFluid.py diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp index db76a39888..6f72f3018c 100755 --- a/src/Mod/Fem/Gui/Workbench.cpp +++ b/src/Mod/Fem/Gui/Workbench.cpp @@ -79,6 +79,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const << "Fem_MaterialMechanicalNonlinear" << "Fem_BeamSection" << "Fem_ShellThickness" + << "Fem_FluidSection" << "Separator" << "Fem_ConstraintFixed" << "Fem_ConstraintDisplacement" @@ -153,6 +154,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "Fem_MaterialMechanicalNonlinear" << "Fem_BeamSection" << "Fem_ShellThickness" + << "Fem_FluidSection" << "Separator" << "Fem_ConstraintFixed" << "Fem_ConstraintDisplacement" diff --git a/src/Mod/Fem/InitGui.py b/src/Mod/Fem/InitGui.py index 601a7dcf7c..45162db972 100644 --- a/src/Mod/Fem/InitGui.py +++ b/src/Mod/Fem/InitGui.py @@ -59,6 +59,7 @@ class FemWorkbench (Workbench): import PyGui._CommandAnalysis import PyGui._CommandShellThickness import PyGui._CommandBeamSection + import PyGui._CommandFluidSection import PyGui._CommandMaterialSolid import PyGui._CommandMaterialFluid import PyGui._CommandMaterialMechanicalNonlinear diff --git a/src/Mod/Fem/PyGui/_CommandFluidSection.py b/src/Mod/Fem/PyGui/_CommandFluidSection.py new file mode 100644 index 0000000000..0be6813d0e --- /dev/null +++ b/src/Mod/Fem/PyGui/_CommandFluidSection.py @@ -0,0 +1,53 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2016 - Ofentse Kgoa * +# * Based on the FemBeamSection by Bernd Hahnebach * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program 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 program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +__title__ = "_CommandFluidSection" +__author__ = "Ofentse Kgoa" +__url__ = "http://www.freecadweb.org" + +## @package CommandFluidSection +# \ingroup FEM + +import FreeCAD +from FemCommands import FemCommands +import FreeCADGui +from PySide import QtCore + + +class _CommandFluidSection(FemCommands): + "The Fem_FluidSection command definition" + def __init__(self): + super(_CommandFluidSection, self).__init__() + self.resources = {'Pixmap': 'fem-fluid-section', + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_FluidSection", "Fluid section for 1D flow"), + 'Accel': "C, B", + 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_FluidSection", "Creates a FEM Fluid section for 1D flow")} + self.is_active = 'with_analysis' + + def Activated(self): + FreeCAD.ActiveDocument.openTransaction("Create FemFluidSection") + FreeCADGui.addModule("ObjectsFem") + FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeFemFluidSection()]") + + +FreeCADGui.addCommand('Fem_FluidSection', _CommandFluidSection())