[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
This commit is contained in:
Uwe
2022-03-30 03:35:13 +02:00
parent 573e4cd772
commit 16ef926fb1

View File

@@ -51,8 +51,10 @@
#include <Gui/Document.h>
#include <Gui/MainWindow.h>
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Fem/App/FemAnalysis.h>
#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);
}
}