From 9080fdafdc0a43cdb4e58e993061c652faf39db3 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 20 Feb 2017 17:56:30 +0100 Subject: [PATCH] FEM: constraint selfweight object, move make def into make objects FEM module --- src/Mod/Fem/App/CMakeLists.txt | 1 - src/Mod/Fem/CMakeLists.txt | 1 - src/Mod/Fem/FemConstraintSelfWeight.py | 43 --------------------- src/Mod/Fem/ObjectsFem.py | 11 ++++++ src/Mod/Fem/_CommandConstraintSelfWeight.py | 4 +- 5 files changed, 13 insertions(+), 47 deletions(-) delete mode 100644 src/Mod/Fem/FemConstraintSelfWeight.py diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 344b1efe88..c30e8654e8 100644 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -121,7 +121,6 @@ SET(FemScripts_SRCS Init.py InitGui.py FemCommands.py - FemConstraintSelfWeight.py FemGmshTools.py FemInputWriter.py FemInputWriterCcx.py diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 94753a47d7..cfd6d8b0c8 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -84,7 +84,6 @@ INSTALL( _TaskPanelFemShellThickness.py TaskPanelFemShellThickness.ui - FemConstraintSelfWeight.py _FemConstraintSelfWeight.py _ViewProviderFemConstraintSelfWeight.py _CommandConstraintSelfWeight.py diff --git a/src/Mod/Fem/FemConstraintSelfWeight.py b/src/Mod/Fem/FemConstraintSelfWeight.py deleted file mode 100644 index 3f919ffa68..0000000000 --- a/src/Mod/Fem/FemConstraintSelfWeight.py +++ /dev/null @@ -1,43 +0,0 @@ -# *************************************************************************** -# * * -# * Copyright (c) 2016 - 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__ = "FemConstraintSelfWeight" -__author__ = "Bernd Hahnebach" -__url__ = "http://www.freecadweb.org" - -## \addtogroup FEM -# @{ - -import FreeCAD -import _FemConstraintSelfWeight - - -def makeFemConstraintSelfWeight(name="FemConstraintSelfWeight"): - '''makeFemFemConstraintSelfWeight([name]): creates an self weight object to define a gravity load''' - obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name) - _FemConstraintSelfWeight._FemConstraintSelfWeight(obj) - if FreeCAD.GuiUp: - import _ViewProviderFemConstraintSelfWeight - _ViewProviderFemConstraintSelfWeight._ViewProviderFemConstraintSelfWeight(obj.ViewObject) - return obj - -# @} diff --git a/src/Mod/Fem/ObjectsFem.py b/src/Mod/Fem/ObjectsFem.py index f6bd0c9410..497fbf9d24 100644 --- a/src/Mod/Fem/ObjectsFem.py +++ b/src/Mod/Fem/ObjectsFem.py @@ -168,6 +168,17 @@ def makeConstraintPulley(name): return obj +def makeConstraintSelfWeight(name="FemConstraintSelfWeight"): + '''makeConstraintSelfWeight([name]): creates an self weight object to define a gravity load''' + obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name) + import _FemConstraintSelfWeight + _FemConstraintSelfWeight._FemConstraintSelfWeight(obj) + if FreeCAD.GuiUp: + import _ViewProviderFemConstraintSelfWeight + _ViewProviderFemConstraintSelfWeight._ViewProviderFemConstraintSelfWeight(obj.ViewObject) + return obj + + def makeConstraintTemperature(name): '''makeConstraintTemperature(name): makes a Fem ConstraintTemperature object''' obj = FreeCAD.ActiveDocument.addObject("Fem::ConstraintTemperature", name) diff --git a/src/Mod/Fem/_CommandConstraintSelfWeight.py b/src/Mod/Fem/_CommandConstraintSelfWeight.py index 0a2a704891..51082f0bd1 100644 --- a/src/Mod/Fem/_CommandConstraintSelfWeight.py +++ b/src/Mod/Fem/_CommandConstraintSelfWeight.py @@ -45,8 +45,8 @@ class _CommandConstraintSelfWeight(FemCommands): def Activated(self): FreeCAD.ActiveDocument.openTransaction("Create FemConstraintSelfWeight") - FreeCADGui.addModule("FemConstraintSelfWeight") - FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [FemConstraintSelfWeight.makeFemConstraintSelfWeight()]") + FreeCADGui.addModule("ObjectsFem") + FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeConstraintSelfWeight()]") FreeCADGui.addCommand('Fem_ConstraintSelfWeight', _CommandConstraintSelfWeight())