pcbnew: router now respects local pad clearances correctly

Fixes: lp:1558858
* https://bugs.launchpad.net/kicad/+bug/1558858
This commit is contained in:
Tomasz Włostowski 2017-12-18 18:51:44 +01:00
parent a4528988ca
commit 3c6d17026e
1 changed files with 10 additions and 5 deletions

View File

@ -821,24 +821,29 @@ void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard )
void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
{ {
int worstPadClearance = 0;
if( !m_board ) if( !m_board )
{ {
wxLogTrace( "PNS", "No board attached, aborting sync." ); wxLogTrace( "PNS", "No board attached, aborting sync." );
return; return;
} }
for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) for( auto module : m_board->Modules() )
{ {
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) for( auto pad : module->Pads() )
{ {
std::unique_ptr< PNS::SOLID > solid = syncPad( pad ); std::unique_ptr< PNS::SOLID > solid = syncPad( pad );
if( solid ) if( solid )
aWorld->Add( std::move( solid ) ); aWorld->Add( std::move( solid ) );
worstPadClearance = std::max( worstPadClearance, pad->GetLocalClearance() );
} }
} }
for( TRACK* t = m_board->m_Track; t; t = t->Next() ) for( auto t : m_board->Tracks() )
{ {
KICAD_T type = t->Type(); KICAD_T type = t->Type();
@ -855,13 +860,13 @@ void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
} }
} }
int worstClearance = m_board->GetDesignSettings().GetBiggestClearanceValue(); int worstRuleClearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
delete m_ruleResolver; delete m_ruleResolver;
m_ruleResolver = new PNS_PCBNEW_RULE_RESOLVER( m_board, m_router ); m_ruleResolver = new PNS_PCBNEW_RULE_RESOLVER( m_board, m_router );
aWorld->SetRuleResolver( m_ruleResolver ); aWorld->SetRuleResolver( m_ruleResolver );
aWorld->SetMaxClearance( 4 * worstClearance ); aWorld->SetMaxClearance( 4 * std::max(worstPadClearance, worstRuleClearance ) );
} }