Created
April 26, 2026 11:34
-
-
Save tritao/30e8b5289fdd0ab3202404956b615cbc to your computer and use it in GitHub Desktop.
Potential fix for FreeCAD/FreeCAD PR #27849 review findings (based on ac7fe6220f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp | |
| --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp | |
| +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp | |
| @@ -61,8 +61,6 @@ | |
| #include <Gui/Command.h> | |
| #include <Gui/Document.h> | |
| #include <Gui/MainWindow.h> | |
| -#include <Gui/View3DInventor.h> | |
| -#include <Gui/View3DInventorViewer.h> | |
| #include <Gui/ViewProviderLink.h> | |
| #include <Mod/Import/App/ReaderGltf.h> | |
| #include <Mod/Import/App/ReaderIges.h> | |
| @@ -243,6 +243,13 @@ private: | |
| ImportOCAFGui ocaf(hDoc, pcDoc, file.fileNamePure()); | |
| ocaf.setImportOptions(ImportOCAFGui::customImportOptions()); | |
| Base::TimeTracker tracker("Import Step"); | |
| + | |
| + if (pyoptions) { | |
| + Py::Dict options(pyoptions); | |
| + if (options.hasKey("showProgress")) { | |
| + ocaf.setShowProgress(static_cast<bool>(Py::Boolean(options.getItem("showProgress")))); | |
| + } | |
| + } | |
| if (file.hasExtension({"stp", "step"})) { | |
| @@ -278,11 +285,6 @@ private: | |
| static_cast<bool>(Py::Boolean(options.getItem("reduceObjects"))) | |
| ); | |
| } | |
| - if (options.hasKey("showProgress")) { | |
| - ocaf.setShowProgress( | |
| - static_cast<bool>(Py::Boolean(options.getItem("showProgress"))) | |
| - ); | |
| - } | |
| if (options.hasKey("expandCompound")) { | |
| ocaf.setExpandCompound( | |
| static_cast<bool>(Py::Boolean(options.getItem("expandCompound"))) | |
| @@ -377,8 +379,8 @@ private: | |
| if (ret) { | |
| App::GetApplication().setActiveDocument(pcDoc); | |
| if (auto gdoc = Gui::Application::Instance->getDocument(pcDoc)) { | |
| - if (auto view = freecad_cast<Gui::View3DInventor*>(gdoc->setActiveView())) { | |
| - view->getViewer()->viewAll(); | |
| + gdoc->setActiveView(); | |
| + Gui::Application::Instance->commandManager().runCommandByName("Std_ViewFitAll"); | |
| } | |
| } | |
| return Py::asObject(ret->getPyObject()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment