Honour m_placingVia when avoiding collisions.

Fixes https://gitlab.com/kicad/code/kicad/issues/3773
This commit is contained in:
Jeff Young 2020-12-20 20:35:31 +00:00
parent e8f38e3c18
commit cd162a8f58
2 changed files with 14 additions and 6 deletions

View File

@ -233,7 +233,7 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType,
if( parentA )
{
parentA->SetLayer( (PCB_LAYER_ID) aLayer );
static_cast<BOARD_CONNECTED_ITEM*>( parentA )->SetNetCode( aItemA->Net() );
static_cast<BOARD_CONNECTED_ITEM*>( parentA )->SetNetCode( aItemA->Net(), true );
}
}
@ -251,7 +251,7 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType,
if( parentB )
{
parentB->SetLayer( (PCB_LAYER_ID) aLayer );
static_cast<BOARD_CONNECTED_ITEM*>( parentB )->SetNetCode( aItemB->Net() );
static_cast<BOARD_CONNECTED_ITEM*>( parentB )->SetNetCode( aItemB->Net(), true );
}
}

View File

@ -490,15 +490,23 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
// If we are allowing DRC violations, we don't push back to the hull
if( !Settings().CanViolateDRC() )
{
int layer = m_head.Layer();
int lineWidth = m_placingVia ? m_head.Via().Diameter() : m_head.Width();
int clearance;
for( OBSTACLE& obs : obstacles )
{
int cl = m_currentNode->GetClearance( obs.m_item, &newHead );
const SHAPE_LINE_CHAIN hull = obs.m_item->Hull( cl, newHead.Width(), newHead.Layer() );
if( m_placingVia )
clearance = m_currentNode->GetClearance( obs.m_item, &m_head.Via() );
else
clearance = m_currentNode->GetClearance( obs.m_item, &m_head );
const SHAPE_LINE_CHAIN hull = obs.m_item->Hull( clearance, lineWidth, layer );
VECTOR2I nearest = hull.NearestPoint( aP );
VECTOR2I nearest = hull.NearestPoint( aP );
Dbg()->AddLine( hull, 2, 10000 );
if( ( nearest - aP ).EuclideanNorm() < newHead.Width() + cl )
if( ( nearest - aP ).EuclideanNorm() < lineWidth + clearance )
{
buildInitialLine( nearest, newHead );