Assign via net before running DRC checks.
Fixes https://gitlab.com/kicad/code/kicad/issues/7579
This commit is contained in:
parent
0c2870c65f
commit
34c2028e7b
|
@ -2241,7 +2241,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasDRCViolation( VIA* aVia )
|
bool checkDRCViolation( VIA* aVia )
|
||||||
{
|
{
|
||||||
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
|
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
|
||||||
std::set<BOARD_ITEM*> checkedItems;
|
std::set<BOARD_ITEM*> checkedItems;
|
||||||
|
@ -2343,12 +2343,15 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
VIA* via = static_cast<VIA*>( aItem );
|
VIA* via = static_cast<VIA*>( aItem );
|
||||||
wxPoint viaPos = via->GetPosition();
|
wxPoint viaPos = via->GetPosition();
|
||||||
int newNet;
|
|
||||||
TRACK* track = findTrack( via );
|
TRACK* track = findTrack( via );
|
||||||
|
|
||||||
if( !m_allowDRCViolations && hasDRCViolation( via ) )
|
if( track )
|
||||||
|
via->SetNetCode( track->GetNetCode() );
|
||||||
|
|
||||||
|
if( !m_allowDRCViolations && checkDRCViolation( via ) )
|
||||||
{
|
{
|
||||||
m_frame->ShowInfoBarError( _( "Via location violates DRC." ) );
|
m_frame->ShowInfoBarError( _( "Via location violates DRC." ) );
|
||||||
|
via->SetNetCode( 0 );
|
||||||
m_flaggedDRC = true;
|
m_flaggedDRC = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2370,18 +2373,13 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
||||||
newTrack->SetStart( viaPos );
|
newTrack->SetStart( viaPos );
|
||||||
aCommit.Add( newTrack );
|
aCommit.Add( newTrack );
|
||||||
}
|
}
|
||||||
|
|
||||||
newNet = track->GetNetCode();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newNet = findStitchedZoneNet( via );
|
via->SetNetCode( findStitchedZoneNet( via ) );
|
||||||
via->SetIsFree();
|
via->SetIsFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( newNet > 0 )
|
|
||||||
via->SetNetCode( newNet );
|
|
||||||
|
|
||||||
aCommit.Add( aItem );
|
aCommit.Add( aItem );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue