Skip to content

Commit

Permalink
FEM: ResultsPurge - delete all results objects including pipelines an…
Browse files Browse the repository at this point in the history
…d filters (FreeCAD#18328)

* FEM: Update resulttools.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* FEM: Update resulttools.py

* FEM: Update commands.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* FEM: Update resulttools.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
FEA-eng and pre-commit-ci[bot] authored Dec 7, 2024
1 parent 94c5772 commit f1995ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Fem/femcommands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def __init__(self):
self.tooltip = Qt.QT_TRANSLATE_NOOP(
"FEM_ResultsPurge", "Purges all results from active analysis"
)
self.is_active = "with_results"
self.is_active = "with_analysis"

def Activated(self):
import femresult.resulttools as resulttools
Expand Down
16 changes: 13 additions & 3 deletions src/Mod/Fem/femresult/resulttools.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def purge_results(analysis):
analysis group as a container for all objects needed for the analysis
"""

# if analysis typ check is used result mesh
# if analysis type 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
Expand All @@ -62,9 +62,19 @@ def purge_results(analysis):
analysis.Document.removeObject(m.Name)
analysis.Document.recompute()

# dat text object
# text object
for m in analysis.Group:
if is_of_type(m, "App::TextDocument") and m.Name.startswith("ccx_dat_file"):
if is_of_type(m, "App::TextDocument"):
analysis.Document.removeObject(m.Name)
analysis.Document.recompute()

# result pipeline and filter
for m in analysis.Group:
if is_of_type(m, "Fem::FemPostPipeline"):
# delete associated filters
for filter_obj in m.Filter:
analysis.Document.removeObject(filter_obj.Name)
# delete the pipeline itself
analysis.Document.removeObject(m.Name)
analysis.Document.recompute()

Expand Down

0 comments on commit f1995ef

Please sign in to comment.