From 66e12af548d7914eebfff50dc83984d4f05c548b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 22 Jan 2022 15:54:10 +0000 Subject: [PATCH] Expand text vars in titleblock before exporting. Fixes https://gitlab.com/kicad/code/kicad/issues/10197 (cherry picked from commit 407660201e1c8c96e00f4dc4462401a7a94e32a6) --- pcbnew/exporters/export_gencad.cpp | 6 +++--- pcbnew/exporters/gerber_jobfile_writer.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index d9f588f410..b755407fe0 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -988,9 +988,9 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) msg = wxT( "DRAWING \"" ) + board->GetFileName() + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); - const TITLE_BLOCK& tb = aFrame->GetTitleBlock(); - - msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" ); + wxString rev = ExpandTextVars( board->GetTitleBlock().GetRevision(), board->GetProject() ); + wxString date = ExpandTextVars( board->GetTitleBlock().GetDate(), board->GetProject() ); + msg = wxT( "REVISION \"" ) + rev + wxT( " " ) + date + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); fputs( "UNITS INCH\n", aFile ); diff --git a/pcbnew/exporters/gerber_jobfile_writer.cpp b/pcbnew/exporters/gerber_jobfile_writer.cpp index b3461338ec..51a5227d45 100644 --- a/pcbnew/exporters/gerber_jobfile_writer.cpp +++ b/pcbnew/exporters/gerber_jobfile_writer.cpp @@ -258,7 +258,7 @@ void GERBER_JOBFILE_WRITER::addJSONGeneralSpecs() msg = fn.GetName(); // build the string. All non ASCII chars and comma are replaced by '_' - wxString rev = m_pcb->GetTitleBlock().GetRevision(); + wxString rev = ExpandTextVars( m_pcb->GetTitleBlock().GetRevision(), m_pcb->GetProject() ); if( rev.IsEmpty() ) rev = wxT( "rev?" );