From 16ef926fb1f0f5cb0a083aedcae56701b8cb5df9 Mon Sep 17 00:00:00 2001 From: Uwe Date: Wed, 30 Mar 2022 03:35:13 +0200 Subject: [PATCH] [FEM] improve sphere cut function handling This commit improves https://github.com/FreeCAD/FreeCAD/commit/e22bcb61 it turned out that it is valid to use a sphere being part of a Pipeline A ,a also for filters in a Pipeline B, C etc. Thus we must recompute the whole analysis container --- .../Fem/Gui/ViewProviderFemPostFunction.cpp | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp index 0eb3282079..442a8447b5 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp @@ -51,8 +51,10 @@ #include #include #include +#include #include "ViewProviderFemPostFunction.h" +#include "ActiveAnalysisObserver.h" #include "TaskPostBoxes.h" #include "ui_PlaneWidget.h" @@ -577,24 +579,13 @@ void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) { } Gui::ViewProviderDocumentObject::updateData(p); - // after updating the geometry we must recompute the pipeline the sphere is in + // after updating the geometry we must recompute + // A sphere can be used by filters in other pipelines than the one the sphere is in. + // Therefore we must recompute the analysis, not only a single pipeline if (p == &func->Center || p == &func->Radius) { - auto directParents = func->getInList(); - // directParents is at the level of the functions container, so we must read the parent of this container - for (auto obj : directParents) { - if (obj->getTypeId() == Base::Type::fromName("Fem::FemPostFunctionProvider")) { - auto outerParents = obj->getInList(); - for (auto objOuter : outerParents) { - if (objOuter->getTypeId() == Base::Type::fromName("Fem::FemPostPipeline") ) { - if (!isDragging()) - // not recursve, otherwise VTK will show an error on initialization - objOuter->recomputeFeature(); - else - objOuter->recomputeFeature(true); - } - } - } - } + auto pcAnalysis = FemGui::ActiveAnalysisObserver::instance()->getActiveObject(); + if (pcAnalysis) + pcAnalysis->recomputeFeature(true); } }