FEM: ResultMechanical add migration code f0r old result objects

Stats containing (min, avg, max) converted to (min, max)
Add Messagebox if histogram requested, but not available
This commit is contained in:
UR-0
2020-02-19 08:04:24 +01:00
committed by Bernd Hahnebach
parent 453370795b
commit e4cdb2fcc9
2 changed files with 16 additions and 2 deletions

View File

@@ -442,7 +442,13 @@ class _TaskPanelFemResultShow:
self.none_selected(True)
def show_histogram_clicked(self):
plt.show()
if len(plt.get_fignums()) > 0:
plt.show()
else:
QtGui.QMessageBox.information(None,
self.result_obj.Label + " - Information",
"No histogram available.\nPlease select a result type first."
)
def user_defined_text(self, equation):
FreeCAD.FEM_dialog["results_type"] = "user"

View File

@@ -286,7 +286,7 @@ class _FemResultMechanical():
# initialize the Stats with the appropriate count of items
# see fill_femresult_stats in femresult/resulttools.py
zero_list = 39 * [0]
zero_list = 26 * [0]
obj.Stats = zero_list
# standard Feature methods
@@ -315,6 +315,14 @@ class _FemResultMechanical():
obj.vonMises = obj.StressValues
obj.removeProperty("StressValues")
# migrate old result objects, because property "Stats"
# consisting of min, avg, max values was reduced to min, max in commit ???????
if len(obj.Stats) == 39:
temp = obj.Stats
for i in range(12, -1, -1):
del temp [3 * i + 1]
obj.Stats = temp
def __getstate__(self):
return self.Type