diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 019e21223a..191ce1b4f0 100644 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -100,6 +100,7 @@ SET(FemScripts_SRCS SET(FemObjectsScripts_SRCS PyObjects/__init__.py PyObjects/_FemConstraintSelfWeight.py + PyObjects/_FemConstraintBodyHeatSource.py PyObjects/_FemElementFluid1D.py PyObjects/_FemElementGeometry1D.py PyObjects/_FemElementGeometry2D.py @@ -146,6 +147,7 @@ SET(FemGuiScripts_SRCS PyGui/__init__.py PyGui/_CommandFemAnalysis.py PyGui/_CommandFemConstraintSelfWeight.py + PyGui/_CommandFemConstraintBodyHeatSource.py PyGui/_CommandFemElementFluid1D.py PyGui/_CommandFemElementGeometry1D.py PyGui/_CommandFemElementGeometry2D.py @@ -178,6 +180,7 @@ SET(FemGuiScripts_SRCS PyGui/_TaskPanelFemSolverCalculix.py PyGui/_TaskPanelFemSolverControl.py PyGui/_ViewProviderFemConstraintSelfWeight.py + PyGui/_ViewProviderFemConstraintBodyHeatSource.py PyGui/_ViewProviderFemElementFluid1D.py PyGui/_ViewProviderFemElementGeometry1D.py PyGui/_ViewProviderFemElementGeometry2D.py diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 8a533b5d70..d20f34ff64 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -50,6 +50,7 @@ INSTALL( FILES PyObjects/__init__.py PyObjects/_FemConstraintSelfWeight.py + PyObjects/_FemConstraintBodyHeatSource.py PyObjects/_FemElementFluid1D.py PyObjects/_FemElementGeometry1D.py PyObjects/_FemElementGeometry2D.py @@ -106,6 +107,7 @@ INSTALL( PyGui/FemSelectionObserver.py PyGui/FemSelectionWidgets.py PyGui/__init__.py + PyGui/_CommandFemConstraintBodyHeatSource.py PyGui/_CommandFemAnalysis.py PyGui/_CommandFemConstraintSelfWeight.py PyGui/_CommandFemElementFluid1D.py @@ -140,6 +142,7 @@ INSTALL( PyGui/_TaskPanelFemSolverCalculix.py PyGui/_TaskPanelFemSolverControl.py PyGui/_ViewProviderFemConstraintSelfWeight.py + PyGui/_ViewProviderFemConstraintBodyHeatSource.py PyGui/_ViewProviderFemElementFluid1D.py PyGui/_ViewProviderFemElementGeometry1D.py PyGui/_ViewProviderFemElementGeometry2D.py diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp index 0cdc8fd903..186b9d3f06 100755 --- a/src/Mod/Fem/Gui/Workbench.cpp +++ b/src/Mod/Fem/Gui/Workbench.cpp @@ -162,7 +162,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const *thermal << "FEM_ConstraintInitialTemperature" << "Separator" << "FEM_ConstraintHeatflux" - << "FEM_ConstraintTemperature"; + << "FEM_ConstraintTemperature" + << "FEM_AddConstraintBodyHeatSource"; Gui::MenuItem* fluid = new Gui::MenuItem; fluid->setCommand("&Fluid Constraints"); diff --git a/src/Mod/Fem/InitGui.py b/src/Mod/Fem/InitGui.py index dd7395fb4c..c1b5271a8e 100644 --- a/src/Mod/Fem/InitGui.py +++ b/src/Mod/Fem/InitGui.py @@ -47,6 +47,7 @@ class FemWorkbench (Workbench): import PyGui._CommandFemAnalysis import PyGui._CommandFemConstraintSelfWeight + import PyGui._CommandFemConstraintBodyHeatSource import PyGui._CommandFemElementFluid1D import PyGui._CommandFemElementGeometry1D import PyGui._CommandFemElementGeometry2D diff --git a/src/Mod/Fem/ObjectsFem.py b/src/Mod/Fem/ObjectsFem.py index 6ff4000e45..43b624658f 100644 --- a/src/Mod/Fem/ObjectsFem.py +++ b/src/Mod/Fem/ObjectsFem.py @@ -44,6 +44,17 @@ def makeConstraintBearing(doc, name="ConstraintBearing"): return obj +def makeConstraintBodyHeatSource(doc, name="ConstraintBodyHeatSource"): + '''makeConstraintBodyHeatSource(document, [name]): makes a Fem ConstraintBodyHeatSource object''' + obj = doc.addObject("Fem::ConstraintPython", name) + import PyObjects._FemConstraintBodyHeatSource + PyObjects._FemConstraintBodyHeatSource.Proxy(obj) + if FreeCAD.GuiUp: + import PyGui._ViewProviderFemConstraintBodyHeatSource + PyGui._ViewProviderFemConstraintBodyHeatSource.ViewProxy(obj.ViewObject) + return obj + + def makeConstraintContact(doc, name="ConstraintContact"): '''makeConstraintContact(document, [name]): makes a Fem ConstraintContact object''' obj = doc.addObject("Fem::ConstraintContact", name) diff --git a/src/Mod/Fem/PyGui/_CommandFemConstraintBodyHeatSource.py b/src/Mod/Fem/PyGui/_CommandFemConstraintBodyHeatSource.py new file mode 100644 index 0000000000..f1486689c9 --- /dev/null +++ b/src/Mod/Fem/PyGui/_CommandFemConstraintBodyHeatSource.py @@ -0,0 +1,59 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2017 - Markus Hovorka * +# * * +# * 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__ = "AddConstraintBodyHeatSource" +__author__ = "Markus Hovorka" +__url__ = "http://www.freecadweb.org" + + +from PySide import QtCore + +import FreeCAD as App +import FreeCADGui as Gui +from PyGui import FemCommands + + +class Command(FemCommands.FemCommands): + + def __init__(self): + super(Command, self).__init__() + self.resources = { + 'Pixmap': 'fem-constraint-heatflux', + 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "FEM_ConstraintBodyHeatSource", + "Constraint body heat source"), + 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "FEM_ConstraintBodyHeatFlux", + "Creates a FEM constraint body heat source")} + self.is_active = 'with_analysis' + + def Activated(self): + App.ActiveDocument.openTransaction( + "Create FemConstraintBodyHeatSource") + Gui.addModule("ObjectsFem") + Gui.doCommand( + "FemGui.getActiveAnalysis().Member += " + "[ObjectsFem.makeConstraintBodyHeatSource()]") + + +Gui.addCommand('FEM_AddConstraintBodyHeatSource', Command()) diff --git a/src/Mod/Fem/PyGui/_ViewProviderFemConstraintBodyHeatSource.py b/src/Mod/Fem/PyGui/_ViewProviderFemConstraintBodyHeatSource.py new file mode 100644 index 0000000000..8d091f2ef0 --- /dev/null +++ b/src/Mod/Fem/PyGui/_ViewProviderFemConstraintBodyHeatSource.py @@ -0,0 +1,35 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2017 - Markus Hovorka * +# * * +# * 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__ = "view provider for constraint body heat source object" +__author__ = "Markus Hovorka, Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + + +import FemConstraint + + +class ViewProxy(FemConstraint.ViewProxy): + + def getIcon(self): + return ":/icons/fem-constraint-heatflux.svg" diff --git a/src/Mod/Fem/PyObjects/_FemConstraintBodyHeatSource.py b/src/Mod/Fem/PyObjects/_FemConstraintBodyHeatSource.py new file mode 100644 index 0000000000..ba4fa5d848 --- /dev/null +++ b/src/Mod/Fem/PyObjects/_FemConstraintBodyHeatSource.py @@ -0,0 +1,40 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2017 - Markus Hovorka * +# * * +# * 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__ = "the constraint body heat source object" +__author__ = "Markus Hovorka, Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + + +import FemConstraint + + +class Proxy(FemConstraint.Proxy): + + Type = "Fem::FemConstraintBodyHeatSource" + + def __init__(self, obj): + super(Proxy, self).__init__(obj) + obj.addProperty( + "App::PropertyFloat", "HeatSource", + "Base", "Body heat source")