Try harder to reassign copper zones on netlist import

This commit is contained in:
Jon Evans 2019-03-18 19:02:24 -04:00 committed by Wayne Stambaugh
parent 82d4029831
commit 4d10183e78
4 changed files with 24 additions and 0 deletions

View File

@ -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." ),

View File

@ -149,6 +149,7 @@ private:
REPORTER* m_reporter;
std::map< ZONE_CONTAINER*, std::vector<D_PAD*> > m_zoneConnectionsCache;
std::map< wxString, wxString> m_oldToNewNets;
std::map< D_PAD*, wxString > m_padNets;
std::vector<MODULE*> m_addedComponents;
std::map<wxString, NETINFO_ITEM*> m_addedNets;

View File

@ -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<D_PAD*> > 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." ),

View File

@ -244,6 +244,9 @@ public:
private:
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
// TODO: remove this when BOARD::updateComponentPadConnections is removed
std::map< wxString, wxString > m_oldToNewNets;
public:
DLIST<MODULE> m_Modules; // linked list of MODULEs