From 2f594dac0a5f312ad67dad60b7dd4fcc1f031339 Mon Sep 17 00:00:00 2001 From: forbes Date: Thu, 5 Feb 2026 19:13:45 -0600 Subject: [PATCH] fix(gui): use Python API for viewDefaultOrientation in StdCmdNew viewDefaultOrientation is a method on View3DInventorPy (Python wrapper), not on View3DInventorViewer (C++ viewer). Use doCommand with the Python API, matching the pattern used in StdCmdViewHome. --- src/Gui/CommandDoc.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 70af7c9a62..75b1ca31b4 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -674,14 +674,15 @@ void StdCmdNew::activated(int iMsg) } // Set default view orientation for the new document - Gui::Document* guiDoc = Application::Instance->getDocument(doc); - if (guiDoc) { - auto views = guiDoc->getMDIViewsOfType(View3DInventor::getClassTypeId()); - for (auto* view : views) { - auto view3d = static_cast(view); - view3d->getViewer()->viewDefaultOrientation(); - } - } + auto hGrp = App::GetApplication().GetParameterGroupByPath( + "User parameter:BaseApp/Preferences/View" + ); + std::string default_view = hGrp->GetASCII("NewDocumentCameraOrientation", "Top"); + doCommand( + Command::Gui, + "Gui.activeDocument().activeView().viewDefaultOrientation('%s',0)", + default_view.c_str() + ); ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath( "User parameter:BaseApp/Preferences/View"