FEM: analysis object, move make def into make objects FEM module

This commit is contained in:
Bernd Hahnebach 2017-02-20 17:43:04 +01:00 committed by wmayer
parent b7c1bb024d
commit c63f1e7753
9 changed files with 18 additions and 51 deletions

View File

@ -120,7 +120,6 @@ SET(FemScripts_SRCS
importZ88O2Results.py
Init.py
InitGui.py
FemAnalysis.py
FemBeamSection.py
FemCommands.py
FemConstraintSelfWeight.py

View File

@ -44,7 +44,6 @@ INSTALL(
_TaskPanelShowResult.py
TaskPanelShowResult.ui
FemAnalysis.py
_CommandAnalysis.py
FemMeshGmsh.py

View File

@ -1,38 +0,0 @@
# ***************************************************************************
# * *
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * *
# * 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__ = "FEM Analysis managment"
__author__ = "Juergen Riegel"
__url__ = "http://www.freecadweb.org"
## \addtogroup FEM
# @{
import FreeCAD
def makeFemAnalysis(name):
'''makeFemAnalysis(name): makes a Fem Analysis object'''
obj = FreeCAD.ActiveDocument.addObject("Fem::FemAnalysisPython", name)
return obj
# @}

View File

@ -30,6 +30,13 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
########## analysis ##########
def makeAnalysis(name):
'''makeAnalysis(name): makes a Fem Analysis object'''
obj = FreeCAD.ActiveDocument.addObject("Fem::FemAnalysisPython", name)
return obj
########## constraints ##########
def makeConstraintBearing(name):
'''makeConstraintBearing(name): makes a Fem ConstraintBearing object'''

View File

@ -27,7 +27,7 @@
import Fem
import FemToolsCcx
import FreeCAD
import FemAnalysis
import ObjectsFem
import FemSolverCalculix
import FemMaterial
import csv
@ -82,7 +82,7 @@ class FemTest(unittest.TestCase):
self.active_doc.recompute()
def create_new_analysis(self):
self.analysis = FemAnalysis.makeFemAnalysis('Analysis')
self.analysis = ObjectsFem.makeAnalysis('Analysis')
self.active_doc.recompute()
def create_new_solver(self):
@ -304,7 +304,7 @@ class TherMechFemTest(unittest.TestCase):
self.active_doc.recompute()
def create_new_analysis(self):
self.analysis = FemAnalysis.makeFemAnalysis('Analysis')
self.analysis = ObjectsFem.makeAnalysis('Analysis')
self.active_doc.recompute()
def create_new_solver(self):

View File

@ -46,9 +46,9 @@ class _CommandAnalysis(FemCommands):
def Activated(self):
FreeCAD.ActiveDocument.openTransaction("Create Analysis")
FreeCADGui.addModule("FemGui")
FreeCADGui.addModule("FemAnalysis")
FreeCADGui.addModule("ObjectsFem")
FreeCADGui.addModule("FemSolverCalculix")
FreeCADGui.doCommand("FemAnalysis.makeFemAnalysis('Analysis')")
FreeCADGui.doCommand("ObjectsFem.makeAnalysis('Analysis')")
FreeCADGui.doCommand("FemGui.setActiveAnalysis(App.activeDocument().ActiveObject)")
FreeCADGui.doCommand("FemSolverCalculix.makeFemSolverCalculix('CalculiX')")
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().ActiveObject]")

View File

@ -70,8 +70,8 @@ def importFrd(filename, analysis=None, result_name_prefix=None):
if(len(m['Nodes']) > 0):
if analysis is None:
analysis_name = os.path.splitext(os.path.basename(filename))[0]
import FemAnalysis
analysis_object = FemAnalysis.makeFemAnalysis('Analysis')
import ObjectsFem
analysis_object = ObjectsFem.makeAnalysis('Analysis')
analysis_object.Label = analysis_name
else:
analysis_object = analysis # see if statement few lines later, if not analysis -> no FemMesh object is created !

View File

@ -78,8 +78,8 @@ def importVTK(filename, analysis=None, result_name_prefix=None):
result_name_prefix = ''
if analysis is None:
analysis_name = os.path.splitext(os.path.basename(filename))[0]
import FemAnalysis
analysis_object = FemAnalysis.makeFemAnalysis('Analysis')
import ObjectsFem
analysis_object = ObjectsFem.makeAnalysis('Analysis')
analysis_object.Label = analysis_name
else:
analysis_object = analysis

View File

@ -71,8 +71,8 @@ def import_z88_disp(filename, analysis=None, result_name_prefix=None):
if(len(m['Nodes']) > 0):
if analysis is None:
analysis_name = os.path.splitext(os.path.basename(filename))[0]
import FemAnalysis
analysis_object = FemAnalysis.makeFemAnalysis('Analysis')
import ObjectsFem
analysis_object = ObjectsFem.makeAnalysis('Analysis')
analysis_object.Label = analysis_name
else:
analysis_object = analysis # see if statement few lines later, if not analysis -> no FemMesh object is created !