Update ratsnest after a footprint change

PCB_BASE_FRAME::PlaceModule() calls CN_CONNECTIVITY_ALGO::Update()
on the new footprint that does not have nets assigned. The Update()
method first removes the footprint (but it has not been added, so
nothing happens) and then adds it with all pads marked as not connected.
Later, when BOARD_COMMIT is pushed - it tries to add the same footprint
again with nets assigned, but the pads are already registered, therefore
they are discarded.

To prevent this, PlaceModule() does not call CN_CONNECTIVITY_ALGO::Update()
for the just created footprint, as it is handled by BOARD_COMMIT later.
This commit is contained in:
Maciej Suminski 2018-03-05 16:37:39 +01:00
parent 0521b63503
commit 3e54e16bdc
2 changed files with 5 additions and 3 deletions

View File

@ -119,7 +119,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
} }
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
board->Add( boardItem ); board->Add( boardItem ); // handles connectivity
} }
else else
@ -128,6 +128,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
wxASSERT( boardItem->Type() != PCB_MODULE_T ); wxASSERT( boardItem->Type() != PCB_MODULE_T );
boardItem->SetParent( board->m_Modules.GetFirst() ); boardItem->SetParent( board->m_Modules.GetFirst() );
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
board->m_Modules->Add( boardItem ); board->m_Modules->Add( boardItem );
} }
@ -226,7 +227,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
view->Remove( module ); view->Remove( module );
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
board->Remove( module ); board->Remove( module ); // handles connectivity
// Clear flags to indicate, that the ratsnest, list of nets & pads are not valid anymore // Clear flags to indicate, that the ratsnest, list of nets & pads are not valid anymore
board->m_Status_Pcb = 0; board->m_Status_Pcb = 0;

View File

@ -411,7 +411,8 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aRecreateRats
m_canvas->SetMouseCapture( NULL, NULL ); m_canvas->SetMouseCapture( NULL, NULL );
m_Pcb->GetConnectivity()->Update( aModule ); if( aRecreateRatsnest )
m_Pcb->GetConnectivity()->Update( aModule );
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aRecreateRatsnest ) if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aRecreateRatsnest )
Compile_Ratsnest( aDC, true ); Compile_Ratsnest( aDC, true );