diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 551d956c2..4f22594a6 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -68,7 +68,8 @@ SET(FemScripts_SRCS _CommandConstraintSelfWeight.py _CommandFEMMesh2Mesh.py _CommandMaterialMechanicalNonlinear.py - _CommandMaterial.py + _CommandMaterialSolid.py + _CommandMaterialFluid.py _CommandMeshGmshFromShape.py _CommandMeshNetgenFromShape.py _CommandMeshGroup.py diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 308e3d580..3aa85c505 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -91,7 +91,8 @@ INSTALL( FemMaterial.py _FemMaterial.py _ViewProviderFemMaterial.py - _CommandMaterial.py + _CommandMaterialSolid.py + _CommandMaterialFluid.py _TaskPanelFemMaterial.py TaskPanelFemMaterial.ui diff --git a/src/Mod/Fem/FemMaterial.py b/src/Mod/Fem/FemMaterial.py index de91e2965..422086f5c 100644 --- a/src/Mod/Fem/FemMaterial.py +++ b/src/Mod/Fem/FemMaterial.py @@ -31,11 +31,25 @@ import FreeCAD import _FemMaterial -def makeFemMaterial(name): - '''makeFemMaterial(name): makes an FEM Material +def makeSolidMaterial(name): + '''makeSolidMaterial(name): makes an FEM Material for solid ''' obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name) _FemMaterial._FemMaterial(obj) + obj.Category = 'Solid' + if FreeCAD.GuiUp: + import _ViewProviderFemMaterial + _ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject) + # FreeCAD.ActiveDocument.recompute() + return obj + + +def makeFluidMaterial(name): + '''makeFluidMaterial(name): makes an FEM Material for fluid + ''' + obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name) + _FemMaterial._FemMaterial(obj) + obj.Category = 'Fluid' if FreeCAD.GuiUp: import _ViewProviderFemMaterial _ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject) diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp index 7f586c73b..ecc672164 100755 --- a/src/Mod/Fem/Gui/Workbench.cpp +++ b/src/Mod/Fem/Gui/Workbench.cpp @@ -74,7 +74,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const << "Fem_MeshGroup" //<< "Fem_CreateNodesSet" << "Separator" - << "Fem_Material" + << "Fem_MaterialSolid" + << "Fem_MaterialFluid" << "Fem_MaterialMechanicalNonlinear" << "Fem_BeamSection" << "Fem_ShellThickness" @@ -147,7 +148,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "Fem_MeshGroup" << "Fem_CreateNodesSet" << "Separator" - << "Fem_Material" + << "Fem_MaterialSolid" + << "Fem_MaterialFluid" << "Fem_MaterialMechanicalNonlinear" << "Fem_BeamSection" << "Fem_ShellThickness" diff --git a/src/Mod/Fem/InitGui.py b/src/Mod/Fem/InitGui.py index c9832faa7..9bd4f84d3 100644 --- a/src/Mod/Fem/InitGui.py +++ b/src/Mod/Fem/InitGui.py @@ -59,7 +59,8 @@ class FemWorkbench (Workbench): import _CommandAnalysis import _CommandShellThickness import _CommandBeamSection - import _CommandMaterial + import _CommandMaterialSolid + import _CommandMaterialFluid import _CommandMaterialMechanicalNonlinear import _CommandSolverCalculix import _CommandSolverZ88 diff --git a/src/Mod/Fem/TaskPanelFemMaterial.ui b/src/Mod/Fem/TaskPanelFemMaterial.ui old mode 100644 new mode 100755 index 9c468f3a1..f680a5eb0 --- a/src/Mod/Fem/TaskPanelFemMaterial.ui +++ b/src/Mod/Fem/TaskPanelFemMaterial.ui @@ -6,8 +6,8 @@ 0 0 - 370 - 700 + 396 + 790 @@ -26,6 +26,31 @@ Material + + + + + + Fluid + + + + + + + Solid + + + + + + + Category + + + + + @@ -86,7 +111,7 @@ - Solid + Body (3D) @@ -102,6 +127,116 @@ + + + + + 16777215 + 1677215 + + + + Basic Properties + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Name: + + + + + + + + 0 + 0 + + + + + 80 + 20 + + + + steel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 2.000000000000000 + + + 2000000000.000000000000000 + + + Pa + + + 3 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + + 80 + 20 + + + + 8000 kg/m^3 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 2.000000000000000 + + + 2000000000.000000000000000 + + + kg/m^3 + + + 3 + + + 0.000000000000000 + + + + + + + Density + + + + + + + + @@ -111,7 +246,7 @@ - Material Properties + Mechanical Properties @@ -201,15 +336,37 @@ - - + + + + + + + + + + 16777215 + 1677215 + + + + Fluidic Properties + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + - Density + Kinetic viscosity: - - + + 0 @@ -223,7 +380,7 @@ - 8000 kg/m^3 + 0.000001 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -235,7 +392,7 @@ 2000000000.000000000000000 - kg/m^3 + Pa 3 @@ -259,7 +416,7 @@ - Temperature-Dependant Material Properties + Thermal Properties diff --git a/src/Mod/Fem/_CommandMaterial.py b/src/Mod/Fem/_CommandMaterialFluid.py similarity index 84% rename from src/Mod/Fem/_CommandMaterial.py rename to src/Mod/Fem/_CommandMaterialFluid.py index 840f6718c..92927ef2b 100644 --- a/src/Mod/Fem/_CommandMaterial.py +++ b/src/Mod/Fem/_CommandMaterialFluid.py @@ -20,7 +20,7 @@ # * * # *************************************************************************** -__title__ = "_CommandMaterial" +__title__ = "_CommandFluidMaterial" __author__ = "Juergen Riegel, Bernd Hahnebach" __url__ = "http://www.freecadweb.org" @@ -34,25 +34,25 @@ import FemGui from PySide import QtCore -class _CommandMaterial(FemCommands): - "the Fem_Material command definition" +class _CommandMaterialFluid(FemCommands): + "the Fem_MaterialFluid command definition" def __init__(self): - super(_CommandMaterial, self).__init__() + super(_CommandMaterialFluid, self).__init__() self.resources = {'Pixmap': 'fem-material', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Material", "FEM material"), + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialFluid", "FEM material for Fluid"), 'Accel': "M, M", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Material", "Creates a FEM material")} + 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialFluid", "Creates a FEM material for Fluid")} self.is_active = 'with_analysis' def Activated(self): femDoc = FemGui.getActiveAnalysis().Document if FreeCAD.ActiveDocument is not femDoc: FreeCADGui.setActiveDocument(femDoc) - FreeCAD.ActiveDocument.openTransaction("Create Material") + FreeCAD.ActiveDocument.openTransaction("Create Fluid Material") FreeCADGui.addModule("FemMaterial") - FreeCADGui.doCommand("FemMaterial.makeFemMaterial('FemMaterial')") + FreeCADGui.doCommand("FemMaterial.makeFluidMaterial('FluidMaterial')") FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]") FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)") -FreeCADGui.addCommand('Fem_Material', _CommandMaterial()) +FreeCADGui.addCommand('Fem_MaterialFluid', _CommandMaterialFluid()) diff --git a/src/Mod/Fem/_CommandMaterialSolid.py b/src/Mod/Fem/_CommandMaterialSolid.py new file mode 100644 index 000000000..d32628f52 --- /dev/null +++ b/src/Mod/Fem/_CommandMaterialSolid.py @@ -0,0 +1,58 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2013 - Juergen Riegel * +# * * +# * 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__ = "_CommandSolidMaterial" +__author__ = "Juergen Riegel, Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +## @package CommandMaterial +# \ingroup FEM + +import FreeCAD +from FemCommands import FemCommands +import FreeCADGui +import FemGui +from PySide import QtCore + + +class _CommandMaterialSolid(FemCommands): + "the Fem_MaterialSolid command definition" + def __init__(self): + super(_CommandMaterialSolid, self).__init__() + self.resources = {'Pixmap': 'fem-material', + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialSolid", "FEM material for solid"), + 'Accel': "M, M", + 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialSolid", "Creates a FEM material for solid")} + self.is_active = 'with_analysis' + + def Activated(self): + femDoc = FemGui.getActiveAnalysis().Document + if FreeCAD.ActiveDocument is not femDoc: + FreeCADGui.setActiveDocument(femDoc) + FreeCAD.ActiveDocument.openTransaction("Create Solid Material") + FreeCADGui.addModule("FemMaterial") + FreeCADGui.doCommand("FemMaterial.makeSolidMaterial('SolidMaterial')") + FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]") + FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)") + + +FreeCADGui.addCommand('Fem_MaterialSolid', _CommandMaterialSolid()) diff --git a/src/Mod/Fem/_FemMaterial.py b/src/Mod/Fem/_FemMaterial.py index 9dd0ab4bc..5ed2eb80a 100644 --- a/src/Mod/Fem/_FemMaterial.py +++ b/src/Mod/Fem/_FemMaterial.py @@ -32,6 +32,8 @@ class _FemMaterial: "The FEM Material object" def __init__(self, obj): obj.addProperty("App::PropertyLinkSubList", "References", "Material", "List of material shapes") + obj.addProperty("App::PropertyEnum", "Category", "Material", "Material type: fluid or solid") + obj.Category = ['Solid', 'Fluid'] obj.Proxy = self self.Type = "FemMaterial"