FEM: vtk result import, workaround for broken stats calculation

This commit is contained in:
Bernd Hahnebach
2018-03-12 15:09:38 +01:00
parent 724da4ee67
commit 07b1a7cdb0
2 changed files with 17 additions and 4 deletions

View File

@@ -396,9 +396,14 @@ def fill_femresult_mechanical(results, result_set, span):
temp_min, temp_avg, temp_max,
mflow_min, mflow_avg, mflow_max,
npress_min, npress_avg, npress_max]
# do not forget to adapt the def get_stats in FemResultTools module as well as the TestFem module
# stat_types = ["U1", "U2", "U3", "Uabs", "Sabs", "MaxPrin", "MidPrin", "MinPrin", "MaxShear", "Peeq", "Temp", "MFlow", "NPress"]
# TODO: a dictionary would be far robust than a list, but needs adapten in VTK too because of VTK result import
# len(stat_types) == 13*3 == 39
# do not forget to adapt the def get_stats in the following code:
# - module femresult/resulttools.py
# - module femtest/testccxtools.py
# - C++ App/FemVTKTools.cpp
# - module feminout/importVTKResults.py (workaround fix in importVtkFCResult for broken function in App/FemVTKTools.cpp)
# TODO: all stats stuff should be reimplemented, ma be a dictionary would be far more robust than a list
return results

View File

@@ -90,8 +90,11 @@ def importVTK(filename, analysis=None, result_name_prefix=None):
from . import importToolsFem
result_obj.DisplacementLengths = importToolsFem.calculate_disp_abs(result_obj.DisplacementVectors)
if analysis:
analysis_object.addObject(result_obj)
# workaround for wrong stats calculation fix in App/VTKtools.cpp
while len(result_obj.Stats) < 39:
tmpstats = result_obj.Stats
tmpstats.append(0.0)
result_obj.Stats = tmpstats
''' seems unused at the moment
filenamebase = '.'.join(filename.split('.')[:-1]) # pattern: filebase_timestamp.vtk
@@ -102,3 +105,8 @@ def importVTK(filename, analysis=None, result_name_prefix=None):
time_step = 0.0
# Stats has been setup in C++ function FemVTKTools importCfdResult()
'''
if analysis:
analysis_object.addObject(result_obj)
result_obj.touch()
FreeCAD.ActiveDocument.recompute()