Skip to content

Commit

Permalink
FEM: Add reset_all funcion to FemTools
Browse files Browse the repository at this point in the history
reset_all groups purge_results, reset_mesh_color and reset_mesh_deformation

Signed-off-by: Przemo Firszt <[email protected]>
  • Loading branch information
PrzemoF authored and wwmayer committed Sep 9, 2015
1 parent 0ba28a5 commit 25b501e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/Mod/Fem/FemTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def reset_mesh_color(self):
self.mesh.ViewObject.ElementColor = {}
self.mesh.ViewObject.setNodeColorByScalars()

## Resets mesh color, deformation and removes all result objects
# @param self The python object self
def reset_all(self):
self.purge_results()
self.reset_mesh_color()
self.reset_mesh_deformation()

def show_result(self, result_type="Sabs", limit=None):
self.update_objects()
if result_type == "None":
Expand Down
16 changes: 4 additions & 12 deletions src/Mod/Fem/MechanicalAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ def GetResources(self):

def Activated(self):
fea = FemTools()
fea.purge_results()
fea.reset_mesh_color()
fea.reset_mesh_deformation()
fea.reset_all()

def IsActive(self):
return FreeCADGui.ActiveDocument is not None and results_present()
Expand All @@ -159,9 +157,7 @@ def load_results(ret_code):
print "CalculiX failed ccx finished with error {}".format(ret_code)

self.fea = FemTools()
self.fea.purge_results()
self.fea.reset_mesh_color()
self.fea.reset_mesh_deformation()
self.fea.reset_all()
message = self.fea.check_prerequisites()
if message:
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
Expand Down Expand Up @@ -194,9 +190,7 @@ def load_results(ret_code):
print "CalculiX failed ccx finished with error {}".format(ret_code)

self.fea = FemTools()
self.fea.purge_results()
self.fea.reset_mesh_color()
self.fea.reset_mesh_deformation()
self.fea.reset_all()
self.fea.set_analysis_type('frequency')
message = self.fea.check_prerequisites()
if message:
Expand Down Expand Up @@ -397,9 +391,7 @@ def calculixFinished(self, exitCode):
self.femConsoleMessage("Loading result sets...")
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
fea = FemTools()
fea.purge_results()
fea.reset_mesh_color()
fea.reset_mesh_deformation()
fea.reset_all()
if os.path.isfile(self.base_name + '.frd'):
QApplication.setOverrideCursor(Qt.WaitCursor)
ccxFrdReader.importFrd(self.base_name + '.frd', FemGui.getActiveAnalysis())
Expand Down

0 comments on commit 25b501e

Please sign in to comment.