eeschema: fix sorting parts generate BOM "Single part per line"
This commit is contained in:
parent
f49c27798e
commit
b8a2c4e240
|
@ -106,6 +106,25 @@ bool SCH_REFERENCE_LIST::sortByRefAndValue( const SCH_REFERENCE& item1,
|
||||||
return ii < 0;
|
return ii < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SCH_REFERENCE_LIST::sortByValueAndRef( const SCH_REFERENCE& item1,
|
||||||
|
const SCH_REFERENCE& item2 )
|
||||||
|
{
|
||||||
|
int ii = item1.CompareValue( item2 );
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = item1.m_Unit - item2.m_Unit;
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = item1.m_SheetNum - item2.m_SheetNum;
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = item1.m_CmpPos.x - item2.m_CmpPos.x;
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = item1.m_CmpPos.y - item2.m_CmpPos.y;
|
||||||
|
if( ii == 0 )
|
||||||
|
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
||||||
|
|
||||||
|
return ii < 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool engStrToDouble( wxString aStr, double* aDouble )
|
static bool engStrToDouble( wxString aStr, double* aDouble )
|
||||||
{
|
{
|
||||||
|
|
|
@ -427,8 +427,8 @@ void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aInc
|
||||||
cmplist.RemoveSubComponentsFromList();
|
cmplist.RemoveSubComponentsFromList();
|
||||||
|
|
||||||
// sort component list by value
|
// sort component list by value
|
||||||
cmplist.SortByValueOnly( );
|
cmplist.SortByRefAndValue( );
|
||||||
PrintComponentsListByPart( f, cmplist,aIncludeSubComponents );
|
PrintComponentsListByPart( f, cmplist, aIncludeSubComponents );
|
||||||
|
|
||||||
fclose( f );
|
fclose( f );
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,6 +376,26 @@ public:
|
||||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByRefAndValue );
|
sort( componentFlatList.begin(), componentFlatList.end(), sortByRefAndValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SortByValueAndRef
|
||||||
|
* sorts the list of references by value.
|
||||||
|
* <p>
|
||||||
|
* Components are sorted in the following order:
|
||||||
|
* <ul>
|
||||||
|
* <li>Value of component.</li>
|
||||||
|
* <li>Numeric value of reference designator.</li>
|
||||||
|
* <li>Unit number when component has multiple parts.</li>
|
||||||
|
* <li>Sheet number.</li>
|
||||||
|
* <li>X coordinate position.</li>
|
||||||
|
* <li>Y coordinate position.</li>
|
||||||
|
* </ul>
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
void SortByValueAndRef()
|
||||||
|
{
|
||||||
|
sort( componentFlatList.begin(), componentFlatList.end(), sortByValueAndRef );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SortByReferenceOnly
|
* Function SortByReferenceOnly
|
||||||
* sorts the list of references by reference.
|
* sorts the list of references by reference.
|
||||||
|
@ -454,6 +474,8 @@ private:
|
||||||
|
|
||||||
static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
|
static bool sortByValueAndRef( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByYPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByYPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
Loading…
Reference in New Issue