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:13:29 +02:00
parent 5b772dde13
commit 2500d5066a
2 changed files with 20 additions and 4 deletions
+10 -2
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 );