From 5ba794266033f24ae4310a9dae387a84aeefe013 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 27 Nov 2018 10:52:20 +0100 Subject: [PATCH] FEM: results, initialize Stats with the appropriate lenght on obj. creation --- src/Mod/Fem/feminout/importToolsFem.py | 4 +++- src/Mod/Fem/femobjects/_FemResultMechanical.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/feminout/importToolsFem.py b/src/Mod/Fem/feminout/importToolsFem.py index 0d1e447e76..437a7debe5 100644 --- a/src/Mod/Fem/feminout/importToolsFem.py +++ b/src/Mod/Fem/feminout/importToolsFem.py @@ -408,7 +408,9 @@ def fill_femresult_stats(results): npress_min, npress_avg, npress_max] # stat_types = ["U1", "U2", "U3", "Uabs", "Sabs", "MaxPrin", "MidPrin", "MinPrin", "MaxShear", "Peeq", "Temp", "MFlow", "NPress"] # len(stat_types) == 13*3 == 39 - # do not forget to adapt the def get_stats in the following code: + # do not forget to adapt initialization of all Stats items in modules: + # - module femobjects/_FemResultMechanical.py + # do not forget to adapt the def get_stats in: # - module femresult/resulttools.py # - module femtest/testccxtools.py # TODO: all stats stuff should be reimplemented, ma be a dictionary would be far more robust than a list diff --git a/src/Mod/Fem/femobjects/_FemResultMechanical.py b/src/Mod/Fem/femobjects/_FemResultMechanical.py index 44a29932ee..0d014303cd 100644 --- a/src/Mod/Fem/femobjects/_FemResultMechanical.py +++ b/src/Mod/Fem/femobjects/_FemResultMechanical.py @@ -62,6 +62,10 @@ class _FemResultMechanical(): obj.addProperty("App::PropertyFloatList", "UserDefined", "NodeData", "User Defined Results", True) obj.addProperty("App::PropertyFloatList", "Temperature", "NodeData", "Temperature field", True) + # initialize the Stats with the appropriate count of items (see fill_femresult_stats in feminout/importToolsFem.py) + zero_list = 39 * [0] + obj.Stats = zero_list + # standard Feature methods def execute(self, obj): """"this method is executed on object creation and whenever the document is recomputed"