Skip to content

Commit

Permalink
FEM: ResultMechanical add migration code f0r old result objects
Browse files Browse the repository at this point in the history
Stats containing (min, avg, max) converted to (min, max)
Add Messagebox if histogram requested, but not available
  • Loading branch information
UR-0 authored and berndhahnebach committed Feb 19, 2020
1 parent 4533707 commit e4cdb2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Expand Up @@ -442,7 +442,13 @@ def peeq_selected(self, state):
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"
Expand Down
10 changes: 9 additions & 1 deletion src/Mod/Fem/femobjects/_FemResultMechanical.py
Expand Up @@ -286,7 +286,7 @@ def __init__(self, obj):

# 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
Expand Down Expand Up @@ -315,6 +315,14 @@ def onDocumentRestored(self, obj):
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

Expand Down

0 comments on commit e4cdb2f

Please sign in to comment.