7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 09:01:42 +00:00

Fp chooser: fix filter by pin count (incorrect count) with multi unit part

Previously, the pin count was the unit pin count, that is incorrect to select
a footprint. the symbol pin count is now used.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/
This commit is contained in:
jean-pierre charras 2024-08-14 13:09:24 +02:00
parent 5b772dde13
commit 2500d5066a
2 changed files with 20 additions and 4 deletions

View File

@ -195,10 +195,18 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
*/
wxString netlist;
// We need the list of pins of the lib symbol, not just the pins of the current
// sch symbol, that can be just an unit of a multi-unit symbol, to be able to
// select/filter right footprints
wxArrayString pins;
for( SCH_PIN* pin : symbol->GetPins( &sheetPath ) )
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
const std::unique_ptr< LIB_SYMBOL >& lib_symbol = symbol->GetLibSymbolRef();
if( lib_symbol )
{
for( SCH_PIN* pin : lib_symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
}
if( !pins.IsEmpty() )
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );

View File

@ -72,10 +72,18 @@ static wxString netList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH& aSheetPath )
*/
wxString netlist;
// We need the list of pins of the lib symbol, not just the pins of the current
// sch symbol, that can be just an unit of a multi-unit symbol, to be able to
// select/filter right footprints
wxArrayString pins;
for( SCH_PIN* pin : aSymbol->GetPins( &aSheetPath ) )
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
const std::unique_ptr< LIB_SYMBOL >& lib_symbol = aSymbol->GetLibSymbolRef();
if( lib_symbol )
{
for( SCH_PIN* pin : lib_symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
}
if( !pins.IsEmpty() )
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );