Output resolved text from PCBNew BOM generator.

This commit is contained in:
Jeff Young 2020-08-20 12:49:59 +01:00
parent 1813db6970
commit 38a994975b
2 changed files with 9 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -28,16 +28,11 @@
#include <fctsys.h> #include <fctsys.h>
#include <confirm.h> #include <confirm.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <gestfich.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <macros.h>
#include <project.h> #include <project.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <wx/listimpl.cpp> #include <wx/listimpl.cpp>
/* creates a BOM list rom board /* creates a BOM list rom board
@ -73,6 +68,7 @@ WX_DECLARE_LIST( cmp, CmpList );
WX_DEFINE_LIST( CmpList ) WX_DEFINE_LIST( CmpList )
void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{ {
wxFileName fn; wxFileName fn;
@ -91,9 +87,8 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir, wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir, fn.GetFullName(),
fn.GetFullName(), CsvFileWildcard(), CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
@ -125,7 +120,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
CmpList::iterator iter; CmpList::iterator iter;
int i = 1; int i = 1;
for( auto module : GetBoard()->Modules() ) for( MODULE* module : GetBoard()->Modules() )
{ {
bool valExist = false; bool valExist = false;
@ -137,7 +132,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
if( (current->m_Val == module->GetValue()) && (current->m_fpid == module->GetFPID()) ) if( (current->m_Val == module->GetValue()) && (current->m_fpid == module->GetFPID()) )
{ {
current->m_Ref.Append( wxT( ", " ), 1 ); current->m_Ref.Append( wxT( ", " ), 1 );
current->m_Ref.Append( module->GetReference() ); current->m_Ref.Append( module->Reference().GetShownText() );
current->m_CmpCount++; current->m_CmpCount++;
valExist = true; valExist = true;
@ -150,8 +145,8 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{ {
comp = new cmp(); comp = new cmp();
comp->m_Id = i++; comp->m_Id = i++;
comp->m_Val = module->GetValue(); comp->m_Val = module->Value().GetShownText();
comp->m_Ref = module->GetReference(); comp->m_Ref = module->Reference().GetShownText();
comp->m_fpid = module->GetFPID(); comp->m_fpid = module->GetFPID();
comp->m_CmpCount = 1; comp->m_CmpCount = 1;
list.Append( comp ); list.Append( comp );

View File

@ -529,7 +529,7 @@ TOOL_ACTION PCB_ACTIONS::generateD356File( "pcbnew.EditorControl.generateD356Fil
TOOL_ACTION PCB_ACTIONS::generateBOM( "pcbnew.EditorControl.generateBOM", TOOL_ACTION PCB_ACTIONS::generateBOM( "pcbnew.EditorControl.generateBOM",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "BOM..." ), _( "Create bill of materials from current schematic" ), _( "BOM..." ), _( "Create bill of materials from board" ),
bom_xpm ); bom_xpm );
// Track & via size control // Track & via size control