Fix missing change for GetPath()

GetPath() returns the sheetpath for each component.  The component KIIDs
for all units are stored in m_kiids, reachable by GetKIIDs().  We no
longer assume a single unit for the component but store all units in the
single COMPONENT for matching reference

Fixes https://gitlab.com/kicad/code/kicad/issues/7658
This commit is contained in:
Seth Hillbrand 2021-02-22 11:21:10 -08:00
parent bac7b3e77a
commit d3cf97847e
1 changed files with 3 additions and 2 deletions

View File

@ -528,14 +528,15 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
return;
}
const KIID& id = component->GetPath().back();
const KIID& id = component->GetKIIDs().front();
// Set new footprint to all instances of the selected component
for( unsigned int idx : GetComponentIndices() )
{
COMPONENT* candidate = m_netlist.GetComponent( idx );
const std::vector<KIID>& kiids = candidate->GetKIIDs();
if( candidate->GetPath().back() == id )
if( std::find( kiids.begin(), kiids.end(), id ) != kiids.end() )
{
// Set the new footprint
candidate->SetFPID( fpid );