netlist: Update via netnames

Vias may need to have their netnames updated because floating vias do
not get a connectivity push.

Fixes: lp:1830102
* https://bugs.launchpad.net/kicad/+bug/1830102
This commit is contained in:
Seth Hillbrand 2019-05-28 07:13:14 -07:00
parent 6b4b2d61f8
commit 10b0b18d80
1 changed files with 46 additions and 0 deletions

View File

@ -415,6 +415,52 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
}
}
for( auto via : m_board->Tracks() )
{
if( via->Type() != PCB_VIA_T )
continue;
if( netlistNetnames.count( via->GetNetname() ) == 0 )
{
wxString updatedNetname = wxEmptyString;
// Take via name from name change map if it didn't match to a new pad
// (this is useful for stitching vias that don't connect to tracks)
if( m_oldToNewNets.count( via->GetNetname() ) )
{
updatedNetname = m_oldToNewNets[via->GetNetname()];
}
if( !updatedNetname.IsEmpty() )
{
msg.Printf( _( "Reconnect via from %s to %s." ),
UnescapeString( via->GetNetname() ), UnescapeString( updatedNetname ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION );
if( !m_isDryRun )
{
NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
if( !netinfo )
netinfo = m_addedNets[updatedNetname];
if( netinfo )
{
m_commit.Modify( via );
via->SetNet( netinfo );
}
}
}
else
{
msg.Printf( _( "Via connected to unknown net (%s)." ),
UnescapeString( via->GetNetname() ) );
m_reporter->Report( msg, REPORTER::RPT_WARNING );
++m_warningCount;
}
}
}
// Test copper zones to detect "dead" nets (nets without any pad):
for( int i = 0; i < m_board->GetAreaCount(); i++ )
{