FEM: mechanical result object, move make def into make objects FEM module

This commit is contained in:
Bernd Hahnebach 2017-02-20 17:57:16 +01:00 committed by wmayer
parent b03b0800ea
commit feae6513bb
7 changed files with 18 additions and 51 deletions

View File

@ -126,7 +126,6 @@ SET(FemScripts_SRCS
FemInputWriterCcx.py
FemInputWriterZ88.py
FemMaterialMechanicalNonlinear.py
FemMechanicalResult.py
FemMesh2Mesh.py
FemMeshGmsh.py
FemMeshGroup.py

View File

@ -37,7 +37,6 @@ INSTALL(
_CommandRunSolver.py
_CommandControlSolver.py
FemMechanicalResult.py
_FemMechanicalResult.py
_ViewProviderFemMechanicalResult.py
_CommandShowResult.py

View File

@ -1,43 +0,0 @@
#***************************************************************************
#* *
#* Copyright (c) 2016 - Qingfeng Xia <qingfeng.xia()eng.ox.ac.uk> *
#* *
#* 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__ = "module to make a mechanical FEM result object"
__author__ = "Qingfeng Xia, Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
## \addtogroup FEM
# \brief FreeCAD module to make mechanical result object in FEM workbench
# @{
import FreeCAD
import _FemMechanicalResult
def makeFemMechanicalResult(result_obj_name):
obj = FreeCAD.ActiveDocument.addObject('Fem::FemResultObjectPython', result_obj_name)
_FemMechanicalResult._FemMechanicalResult(obj)
if FreeCAD.GuiUp:
from _ViewProviderFemMechanicalResult import _ViewProviderFemMechanicalResult
_ViewProviderFemMechanicalResult(obj.ViewObject)
return obj
# @}

View File

@ -95,6 +95,18 @@ def makeShellThickness(thickness=20.0, name="ShellThickness"):
return obj
########## results ##########
def makeMechanicalResult(name="MechanicalResult"):
'''makeMechanicalResult(name): creates an mechanical object result to hold FEM results'''
obj = FreeCAD.ActiveDocument.addObject('Fem::FemResultObjectPython', name)
import _FemMechanicalResult
_FemMechanicalResult._FemMechanicalResult(obj)
if FreeCAD.GuiUp:
from _ViewProviderFemMechanicalResult import _ViewProviderFemMechanicalResult
_ViewProviderFemMechanicalResult(obj.ViewObject)
return obj
########## constraints ##########
def makeConstraintBearing(name):
'''makeConstraintBearing(name): makes a Fem ConstraintBearing object'''

View File

@ -108,8 +108,8 @@ def importFrd(filename, analysis=None, result_name_prefix=None):
results_name = result_name_prefix + 'time_' + str(step_time) + '_results'
else:
results_name = result_name_prefix + 'results'
import FemMechanicalResult
results = FemMechanicalResult.makeFemMechanicalResult(results_name)
import ObjectsFem
results = ObjectsFem.makeMechanicalResult(results_name)
for m in analysis_object.Member:
if m.isDerivedFrom("Fem::FemMeshObject"):
results.Mesh = m

View File

@ -86,8 +86,8 @@ def importVTK(filename, analysis=None, result_name_prefix=None):
# if properties can be added in FemVTKTools importCfdResult(), this file can be used for CFD workbench
results_name = result_name_prefix + 'results'
from FemMechanicalResult import makeFemMechanicalResult
result_obj = makeFemMechanicalResult(results_name)
import ObjectsFem
result_obj = ObjectsFem.makeMechanicalResult(results_name)
# result_obj = FreeCAD.ActiveDocument.addObject('Fem::FemResultObject', results_name)
Fem.readResult(filename, result_obj.Name) # readResult always creates a new femmesh named ResultMesh

View File

@ -79,8 +79,8 @@ def import_z88_disp(filename, analysis=None, result_name_prefix=None):
for result_set in m['Results']:
results_name = result_name_prefix + 'results'
import FemMechanicalResult
results = FemMechanicalResult.makeFemMechanicalResult(results_name)
import ObjectsFem
results = ObjectsFem.makeMechanicalResult(results_name)
#results = FreeCAD.ActiveDocument.addObject('Fem::FemResultObject', results_name)
for m in analysis_object.Member:
if m.isDerivedFrom("Fem::FemMeshObject"):