From 6598ad81e76e0c1b98103294aa78301e7e9327a8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 22 Aug 2020 22:07:46 +0100 Subject: [PATCH] Resolve text vars when exporting IDF. Fixes https://gitlab.com/kicad/code/kicad/issues/5287 --- pcbnew/exporters/export_idf.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 601e36460c..600a3df3d5 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -278,11 +278,11 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, IDF3_BOARD& aIDFBoard ) { // Reference Designator - std::string crefdes = TO_UTF8( aModule->GetReference() ); + std::string crefdes = TO_UTF8( aModule->Reference().GetShownText() ); if( crefdes.empty() || !crefdes.compare( "~" ) ) { - std::string cvalue = TO_UTF8( aModule->GetValue() ); + std::string cvalue = TO_UTF8( aModule->Value().GetShownText() ); // if both the RefDes and Value are empty or set to '~' the board owns the part, // otherwise associated parts of the module must be marked NOREFDES. @@ -331,7 +331,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" ) || ( kplate == IDF3::NPTH ) - ||( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) ) + || ( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) ) pintype = "MTG"; else pintype = "PIN"; @@ -410,7 +410,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, while( sM != eM ) { - idfFile.Assign( resolver->ResolvePath( sM->m_Filename ) ); + idfFile.Assign( resolver->ResolvePath( sM->m_Filename ) ); idfExt = idfFile.GetExt(); if( idfExt.Cmp( wxT( "idf" ) ) && idfExt.Cmp( wxT( "IDF" ) ) ) @@ -421,7 +421,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, if( refdes.empty() ) { - refdes = TO_UTF8( aModule->GetReference() ); + refdes = TO_UTF8( aModule->Reference().GetShownText() ); // NOREFDES cannot be used or else the software gets confused // when writing out the placement data due to conflicting @@ -438,7 +438,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, if( !outline ) throw( std::runtime_error( aIDFBoard.GetError() ) ); - double rotz = aModule->GetOrientation()/10.0; + double rotz = aModule->GetOrientation() / 10.0; double locx = sM->m_Offset.x * 25.4; // part offsets are in inches double locy = sM->m_Offset.y * 25.4; double locz = sM->m_Offset.z * 25.4; @@ -564,8 +564,6 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, comp->AddOutlineData( data ); ++sM; } - - return; } @@ -575,7 +573,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, * files representing the user's PCB design. */ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, - bool aUseThou, double aXRef, double aYRef ) + bool aUseThou, double aXRef, double aYRef ) { IDF3_BOARD idfBoard( IDF3::CAD_ELEC );