Ensure nets are referenced to main board
We set new elements to the temporary board's netlist. These need to be updated when moving the fooprint to the main board Fixes https://gitlab.com/kicad/code/kicad/-/issues/17242
This commit is contained in:
parent
5ff61ae561
commit
54efd32f7a
|
@ -927,6 +927,28 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
||||||
fixUuid( const_cast<KIID&>( aChild->m_Uuid ) );
|
fixUuid( const_cast<KIID&>( aChild->m_Uuid ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Right now, we only show the "Unconnected" net in the footprint editor, but this is still
|
||||||
|
// referenced in the footprint. So we need to update the net pointers in the footprint to
|
||||||
|
// point to the nets in the main board.
|
||||||
|
newFootprint->RunOnDescendants(
|
||||||
|
[&]( BOARD_ITEM* aChild )
|
||||||
|
{
|
||||||
|
if( BOARD_CONNECTED_ITEM* conn = dynamic_cast<BOARD_CONNECTED_ITEM*>( aChild ) )
|
||||||
|
{
|
||||||
|
NETINFO_ITEM* net = conn->GetNet();
|
||||||
|
auto& netmap = mainpcb->GetNetInfo().NetsByName();
|
||||||
|
|
||||||
|
if( net )
|
||||||
|
{
|
||||||
|
auto it = netmap.find( net->GetNetname() );
|
||||||
|
|
||||||
|
if( it != netmap.end() )
|
||||||
|
conn->SetNet( it->second );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
BOARD_DESIGN_SETTINGS& bds = m_pcb->GetDesignSettings();
|
BOARD_DESIGN_SETTINGS& bds = m_pcb->GetDesignSettings();
|
||||||
|
|
||||||
newFootprint->ApplyDefaultSettings( *m_pcb, bds.m_StyleFPFields, bds.m_StyleFPText,
|
newFootprint->ApplyDefaultSettings( *m_pcb, bds.m_StyleFPFields, bds.m_StyleFPText,
|
||||||
|
|
Loading…
Reference in New Issue