FEM: result tools, delete result meshes on result purging too

This commit is contained in:
Bernd Hahnebach
2019-03-03 21:06:05 +01:00
committed by wmayer
parent 5378c431cb
commit 8cfacc039c
2 changed files with 9 additions and 2 deletions

View File

@@ -28,10 +28,11 @@ __url__ = "http://www.freecadweb.org"
# @{
import FreeCAD
import femtools.femutils as femutils
from math import sqrt
## Removes all result objects from an analysis group
## Removes all result objects and result meshes from an analysis group
# @param analysis
def purge_results(analysis):
for m in analysis.Group:
@@ -40,6 +41,12 @@ def purge_results(analysis):
analysis.Document.removeObject(m.Mesh.Name)
analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()
# if analysis typ check is used result mesh without result obj is created in the analysis
# we could run into trouble in one loop because we will delete objects and try to access them later
for m in analysis.Group:
if femutils.is_of_type(m, 'Fem::FemMeshResult'):
analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()
## Resets result mesh deformation

View File

@@ -87,7 +87,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
else:
raise Exception('FEM: Somthing went wront, the exception should have been raised earlier!')
## Removes all result objects from an analysis group
## Removes all result objects and result meshes from an analysis group
# @param self The python object self
def purge_results(self):
from femresult.resulttools import purge_results as pr