From 813fce2d2d668b229d8991d5727979ac6d1eaeaa Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 18 Apr 2024 02:57:39 +0200 Subject: [PATCH] Fully expand all text variables in 3d output We were doing half of the job but we need to get the board variables as well Fixes https://gitlab.com/kicad/code/kicad/issues/17768 (cherry picked from commit 79166510e97e52ee1ee05319e58a1d50cb8fb37c) --- pcbnew/dialogs/dialog_export_step.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index f79b680741..e1a1fe11da 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -379,7 +379,16 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) wxString path = m_outputFileName->GetValue(); m_parent->SetLastPath( LAST_PATH_STEP, path ); + // Build the absolute path of current output directory to preselect it in the file browser. + std::function textResolver = + [&]( wxString* token ) -> bool + { + return m_parent->GetBoard()->ResolveTextVar( token, 0 ); + }; + + path = ExpandTextVars( path, &textResolver ); path = ExpandEnvVarSubstitutions( path, &Prj() ); + path = Prj().AbsolutePath( path ); if( path.IsEmpty() ) {