Commit 5742bfb8 authored by Marco Mattila's avatar Marco Mattila

Fix eeschema single part per line bom generation.

parent 465dabd9
......@@ -468,7 +468,7 @@ void DIALOG_BUILD_BOM::CreatePartsList( )
cmplist.RemoveSubComponentsFromList();
// sort component list by value
cmplist.SortByValueAndRef( );
cmplist.SortByValueOnly( );
PrintComponentsListByPart( f, cmplist, false );
fclose( f );
......@@ -872,14 +872,14 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* aFile, SCH_REFERENCE_LIST
while( index < aList.GetCount() )
{
SCH_COMPONENT *component = aList[index].GetComponent();
wxString referenceListStr;
wxArrayString referenceStrList;
int qty = 1;
referenceListStr.append( aList[index].GetRef() );
referenceStrList.Add( aList[index].GetRef() );
for( unsigned int i = index+1; i < aList.GetCount(); )
{
if( *(aList[i].GetComponent()) == *component )
{
referenceListStr.append( wxT( " " ) + aList[i].GetRef() );
referenceStrList.Add( aList[i].GetRef() );
aList.RemoveItem( i );
qty++;
}
......@@ -887,10 +887,22 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* aFile, SCH_REFERENCE_LIST
i++; // Increment index only when current item is not removed from the list
}
// Write value, quantity and list of references
fprintf( aFile, "%15s%c%3d%c\"%s\"", TO_UTF8( component->GetField( VALUE )->GetText() ),
s_ExportSeparatorSymbol, qty,
s_ExportSeparatorSymbol, TO_UTF8( referenceListStr ) );
referenceStrList.Sort( RefDesStringCompare ); // Sort references for this component
// Write value, quantity
fprintf( aFile, "%15s%c%3d", TO_UTF8( component->GetField( VALUE )->GetText() ),
s_ExportSeparatorSymbol, qty );
// Write list of references
for( int i = 0; i < referenceStrList.Count(); i++ )
{
if( i == 0 )
fprintf( aFile, "%c\"%s", s_ExportSeparatorSymbol, TO_UTF8( referenceStrList[i] ) );
else
fprintf( aFile, " %s", TO_UTF8( referenceStrList[i] ) );
}
if( referenceStrList.Count() )
fprintf( aFile, "\"" );
// Write the rest of the fields if required
#if defined( KICAD_GOST )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment