FEM: constraint body heat source, add object, command, etc

This commit is contained in:
Markus Hovorka
2017-12-01 19:43:31 +01:00
committed by wmayer
parent 073ac25e99
commit 8119d76ad3
8 changed files with 154 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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");

View File

@@ -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

View File

@@ -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)

View File

@@ -0,0 +1,59 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
# * *
# * 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())

View File

@@ -0,0 +1,35 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
# * *
# * 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"

View File

@@ -0,0 +1,40 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
# * *
# * 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")