Browse Source

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.
pull/5/merge
Maciej Suminski 8 years ago
parent
commit
3e54e16bdc
  1. 5
      pcbnew/board_commit.cpp
  2. 3
      pcbnew/pcb_footprint_edit_utils.cpp

5
pcbnew/board_commit.cpp

@ -119,7 +119,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
}
if( !( changeFlags & CHT_DONE ) )
board->Add( boardItem );
board->Add( boardItem ); // handles connectivity
}
else
@ -128,6 +128,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
wxASSERT( boardItem->Type() != PCB_MODULE_T );
boardItem->SetParent( board->m_Modules.GetFirst() );
if( !( changeFlags & CHT_DONE ) )
board->m_Modules->Add( boardItem );
}
@ -226,7 +227,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
view->Remove( module );
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
board->m_Status_Pcb = 0;

3
pcbnew/pcb_footprint_edit_utils.cpp

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

Loading…
Cancel
Save