From 1bd5739708f227495e284cc75ac591e4575077a8 Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 24 Mar 2023 04:14:49 +0100 Subject: [PATCH] [FEM] auto-activate Analyses - this PR addresses a long-standing annoying issue: You are already in the FEM WB and load a file. Then you cannot just start but first have to activate the Analysis. But one is in the FEM WB to work with analyses. --- src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp index 6cf3adb674..49b2730609 100644 --- a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include #include @@ -103,6 +105,18 @@ void ViewProviderFemAnalysis::attach(App::DocumentObject *obj) { Gui::ViewProviderDocumentObjectGroup::attach(obj); extension.attach(this); + // activate analysis if currently active workbench is FEM + auto *workbench = Gui::WorkbenchManager::instance()->active(); + if (workbench->name() == "FemWorkbench") { + doubleClicked(); + // indicate the activated analysis by selecting it + // especially useful for files with 2 or more analyses but also + // necessary for the workflow with new files to add a solver as next object + std::vector selVector {}; + selVector.push_back(this->getObject()); + auto docName = this->getObject()->getDocument()->getName(); + Gui::Selection().setSelection(docName, selVector); + } } void ViewProviderFemAnalysis::highlightView(Gui::ViewProviderDocumentObject *view)