diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp index b215948886..604c4a2e43 100644 --- a/pcbnew/board_netlist_updater.cpp +++ b/pcbnew/board_netlist_updater.cpp @@ -339,6 +339,8 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent if( !pad->GetNetname().IsEmpty() ) { + m_oldToNewNets[ pad->GetNetname() ] = netName; + msg.Printf( _( "Reconnect %s pin %s from %s to %s."), aPcbComponent->GetReference(), pad->GetName(), @@ -427,6 +429,13 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) } } + // Take zone name from name change map if it didn't match to a new pad + // (this is useful for zones on internal layers) + if( updatedNetname.IsEmpty() && m_oldToNewNets.count( zone->GetNetname() ) ) + { + updatedNetname = m_oldToNewNets[ zone->GetNetname() ]; + } + if( !updatedNetname.IsEmpty() ) { msg.Printf( _( "Reconnect copper zone from %s to %s." ), diff --git a/pcbnew/board_netlist_updater.h b/pcbnew/board_netlist_updater.h index 53e13c5bab..04ff03ce51 100644 --- a/pcbnew/board_netlist_updater.h +++ b/pcbnew/board_netlist_updater.h @@ -149,6 +149,7 @@ private: REPORTER* m_reporter; std::map< ZONE_CONTAINER*, std::vector > m_zoneConnectionsCache; + std::map< wxString, wxString> m_oldToNewNets; std::map< D_PAD*, wxString > m_padNets; std::vector m_addedComponents; std::map m_addedNets; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 6cbb2e7a32..e01afc5e87 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2497,6 +2497,8 @@ void BOARD::updateComponentPadConnections( NETLIST& aNetlist, MODULE* footprint, if( pad->GetNetname() != netName ) { + m_oldToNewNets[ pad->GetNetname() ] = netName; + msg.Printf( _( "Changing footprint %s pad %s net from %s to %s." ), footprint->GetReference(), pad->GetName(), @@ -2533,6 +2535,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, std::map< ZONE_CONTAINER*, std::vector > zoneConnectionsCache; MODULE* lastPreexistingFootprint = m_Modules.GetLast(); + m_oldToNewNets.clear(); + for( int ii = 0; ii < GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = GetArea( ii ); @@ -2886,6 +2890,13 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, } } + // Take zone name from name change map if it didn't match to a new pad + // (this is useful for zones on internal layers) + if( !updatedNet && m_oldToNewNets.count( zone->GetNetname() ) ) + { + updatedNet = FindNet( m_oldToNewNets[ zone->GetNetname() ] ); + } + if( updatedNet ) { msg.Printf( _( "Updating copper zone from net %s to %s." ), diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 9e5edddb8e..ee4eaf84a3 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -244,6 +244,9 @@ public: private: DLIST m_Drawings; // linked list of lines & texts + // TODO: remove this when BOARD::updateComponentPadConnections is removed + std::map< wxString, wxString > m_oldToNewNets; + public: DLIST m_Modules; // linked list of MODULEs