From 144cdd98cea417c3a6346b712014bd05afdaee9b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 14 Oct 2025 16:27:53 +0100 Subject: [PATCH] Replace comment; change format name. Fixes https://gitlab.com/kicad/code/kicad/-/issues/21982 (cherry picked from commit d8b4fde1c8437dadc8253591966e9dceb17b6986) --- ...ialog_gen_footprint_position_file_base.cpp | 2 +- ...ialog_gen_footprint_position_file_base.fbp | 2 +- pcbnew/exporters/place_file_exporter.cpp | 63 ++++++++++--------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp index 3b0564df73..fc5dc94b87 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp @@ -56,7 +56,7 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow m_formatLabel->Wrap( -1 ); fgSizer1->Add( m_formatLabel, 0, wxRIGHT, 5 ); - wxString m_formatCtrlChoices[] = { _("ASCII"), _("CSV"), _("Gerber X3") }; + wxString m_formatCtrlChoices[] = { _("Plain text"), _("CSV"), _("Gerber X3") }; int m_formatCtrlNChoices = sizeof( m_formatCtrlChoices ) / sizeof( wxString ); m_formatCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_formatCtrlNChoices, m_formatCtrlChoices, 0 ); m_formatCtrl->SetSelection( 0 ); diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp index a431b4300d..930da2ba5c 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp @@ -393,7 +393,7 @@ 1 0 - "ASCII" "CSV" "Gerber X3" + "Plain text" "CSV" "Gerber X3" 1 1 diff --git a/pcbnew/exporters/place_file_exporter.cpp b/pcbnew/exporters/place_file_exporter.cpp index f8c7fe16f8..b49472cca0 100644 --- a/pcbnew/exporters/place_file_exporter.cpp +++ b/pcbnew/exporters/place_file_exporter.cpp @@ -174,7 +174,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() // Set first line:; snprintf( line, sizeof(line), "Ref%cVal%cPackage%cPosX%cPosY%cRot%cSide\n", - csv_sep, csv_sep, csv_sep, csv_sep, csv_sep, csv_sep ); + csv_sep, csv_sep, csv_sep, csv_sep, csv_sep, csv_sep ); buffer += line; @@ -190,28 +190,28 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() if( layer == B_Cu && m_negateBottomX ) footprint_pos.x = - footprint_pos.x; - wxString tmp = wxT( "\"" ) + list[ii].m_Reference; - tmp << wxT( "\"" ) << csv_sep; - tmp << wxT( "\"" ) << list[ii].m_Value; - tmp << wxT( "\"" ) << csv_sep; - tmp << wxT( "\"" ) << list[ii].m_Footprint->GetFPID().GetLibItemName().wx_str(); - tmp << wxT( "\"" ) << csv_sep; + wxLine = wxT( "\"" ) + list[ii].m_Reference; + wxLine << wxT( "\"" ) << csv_sep; + wxLine << wxT( "\"" ) << list[ii].m_Value; + wxLine << wxT( "\"" ) << csv_sep; + wxLine << wxT( "\"" ) << list[ii].m_Footprint->GetFPID().GetLibItemName().wx_str(); + wxLine << wxT( "\"" ) << csv_sep; - tmp << wxString::Format( wxT( "%f%c%f%c%f" ), - footprint_pos.x * conv_unit, - csv_sep, - // Keep the Y axis oriented from bottom to top, - // ( change y coordinate sign ) - -footprint_pos.y * conv_unit, - csv_sep, - list[ii].m_Footprint->GetOrientation().AsDegrees() ); - tmp << csv_sep; + wxLine << wxString::Format( wxT( "%f%c%f%c%f" ), + footprint_pos.x * conv_unit, + csv_sep, + // Keep the Y axis oriented from bottom to top, + // ( change y coordinate sign ) + -footprint_pos.y * conv_unit, + csv_sep, + list[ii].m_Footprint->GetOrientation().AsDegrees() ); + wxLine << csv_sep; - tmp << ( (layer == F_Cu ) ? PLACE_FILE_EXPORTER::GetFrontSideName() - : PLACE_FILE_EXPORTER::GetBackSideName() ); - tmp << '\n'; + wxLine << ( (layer == F_Cu ) ? PLACE_FILE_EXPORTER::GetFrontSideName() + : PLACE_FILE_EXPORTER::GetBackSideName() ); + wxLine << '\n'; - buffer += TO_UTF8( tmp ); + buffer += TO_UTF8( wxLine ); } } else @@ -230,9 +230,9 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() buffer += "## Side : "; if( m_side == PCB_BACK_SIDE ) - buffer += GetBackSideName().c_str(); + buffer += GetBackSideName(); else if( m_side == PCB_FRONT_SIDE ) - buffer += GetFrontSideName().c_str(); + buffer += GetFrontSideName(); else if( m_side == PCB_BOTH_SIDES ) buffer += "All"; else @@ -241,9 +241,9 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() buffer += "\n"; snprintf( line, sizeof(line), "%-*s %-*s %-*s %9.9s %9.9s %8.8s %s\n", - int(lenRefText), "# Ref", - int(lenValText), "Val", - int(lenPkgText), "Package", + lenRefText, "# Ref", + lenValText, "Val", + lenPkgText, "Package", "PosX", "PosY", "Rot", "Side" ); buffer += line; @@ -265,10 +265,15 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() ref.Replace( wxT( " " ), wxT( "_" ) ); val.Replace( wxT( " " ), wxT( "_" ) ); pkg.Replace( wxT( " " ), wxT( "_" ) ); - wxLine.Printf( "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n", lenRefText, ref, lenValText, val, lenPkgText, - pkg, footprint_pos.x * conv_unit, -footprint_pos.y * conv_unit, - list[ii].m_Footprint->GetOrientation().AsDegrees(), - ( layer == F_Cu ) ? GetFrontSideName() : GetBackSideName() ); + wxLine.Printf( wxT( "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n" ), + lenRefText, ref, + lenValText, val, + lenPkgText, pkg, + footprint_pos.x * conv_unit, + // Keep the coordinates in the first quadrant, (i.e. change y sign) + -footprint_pos.y * conv_unit, + list[ii].m_Footprint->GetOrientation().AsDegrees(), + ( layer == F_Cu ) ? GetFrontSideName() : GetBackSideName() ); buffer += TO_UTF8( wxLine ); }