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( ) ...@@ -468,7 +468,7 @@ void DIALOG_BUILD_BOM::CreatePartsList( )
cmplist.RemoveSubComponentsFromList(); cmplist.RemoveSubComponentsFromList();
// sort component list by value // sort component list by value
cmplist.SortByValueAndRef( ); cmplist.SortByValueOnly( );
PrintComponentsListByPart( f, cmplist, false ); PrintComponentsListByPart( f, cmplist, false );
fclose( f ); fclose( f );
...@@ -872,14 +872,14 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* aFile, SCH_REFERENCE_LIST ...@@ -872,14 +872,14 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* aFile, SCH_REFERENCE_LIST
while( index < aList.GetCount() ) while( index < aList.GetCount() )
{ {
SCH_COMPONENT *component = aList[index].GetComponent(); SCH_COMPONENT *component = aList[index].GetComponent();
wxString referenceListStr; wxArrayString referenceStrList;
int qty = 1; int qty = 1;
referenceListStr.append( aList[index].GetRef() ); referenceStrList.Add( aList[index].GetRef() );
for( unsigned int i = index+1; i < aList.GetCount(); ) for( unsigned int i = index+1; i < aList.GetCount(); )
{ {
if( *(aList[i].GetComponent()) == *component ) if( *(aList[i].GetComponent()) == *component )
{ {
referenceListStr.append( wxT( " " ) + aList[i].GetRef() ); referenceStrList.Add( aList[i].GetRef() );
aList.RemoveItem( i ); aList.RemoveItem( i );
qty++; qty++;
} }
...@@ -887,10 +887,22 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( FILE* aFile, SCH_REFERENCE_LIST ...@@ -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 i++; // Increment index only when current item is not removed from the list
} }
// Write value, quantity and list of references referenceStrList.Sort( RefDesStringCompare ); // Sort references for this component
fprintf( aFile, "%15s%c%3d%c\"%s\"", TO_UTF8( component->GetField( VALUE )->GetText() ),
s_ExportSeparatorSymbol, qty, // Write value, quantity
s_ExportSeparatorSymbol, TO_UTF8( referenceListStr ) ); 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 // Write the rest of the fields if required
#if defined( KICAD_GOST ) #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