Allow free pad usage in router.

Fixes https://gitlab.com/kicad/code/kicad/issues/11730
This commit is contained in:
Jeff Young 2022-09-05 19:44:41 +01:00
parent 3534cfbba8
commit 7c83c78afe
4 changed files with 27 additions and 7 deletions

View File

@ -51,6 +51,10 @@ bool ITEM::collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferent
if( aDifferentNetsOnly && m_net == aOther->m_net && m_net >= 0 && aOther->m_net >= 0 )
return false;
// a pad associated with a "free" pin (NIC) doesn't have a net until it has been used
if( aDifferentNetsOnly && ( IsFreePad() || aOther->IsFreePad() ) )
return false;
// check if we are not on completely different layers first
if( !m_layers.Overlaps( aOther->m_layers ) )
return false;

View File

@ -81,6 +81,7 @@ public:
m_rank = -1;
m_routable = true;
m_isVirtual = false;
m_isFreePad = false;
m_isCompoundShapePrimitive = false;
}
@ -96,6 +97,7 @@ public:
m_rank = aOther.m_rank;
m_routable = aOther.m_routable;
m_isVirtual = aOther.m_isVirtual;
m_isFreePad = aOther.m_isFreePad;
m_isCompoundShapePrimitive = aOther.m_isCompoundShapePrimitive;
}
@ -232,6 +234,9 @@ public:
void SetRoutable( bool aRoutable ) { m_routable = aRoutable; }
bool IsRoutable() const { return m_routable; }
void SetIsFreePad( bool aIsFreePad = true ) { m_isFreePad = aIsFreePad; }
bool IsFreePad() const { return m_isFreePad; }
bool IsVirtual() const
{
return m_isVirtual;
@ -256,6 +261,7 @@ protected:
int m_rank;
bool m_routable;
bool m_isVirtual;
bool m_isFreePad;
bool m_isCompoundShapePrimitive;
};

View File

@ -970,6 +970,9 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad )
solid->SetPadToDie( aPad->GetPadToDieLength() );
solid->SetOrientation( aPad->GetOrientation() );
if( aPad->IsFreePad() )
solid->SetIsFreePad();
VECTOR2I wx_c = aPad->ShapePos();
VECTOR2I offset = aPad->GetOffset();

View File

@ -133,13 +133,14 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b
//if( item->Parent() && !item->Parent()->ViewIsVisible() )
// continue;
if( aNet <= 0 || item->Net() == aNet )
if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
{
continue;
}
else if( aNet <= 0 || item->Net() == aNet )
{
if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
{
if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
continue;
SEG::ecoord d = ( item->Shape()->Centre() - aWhere ).SquaredEuclideanNorm();
if( d < dist[2] )
@ -173,12 +174,18 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b
}
}
}
else if( item->OfKind( ITEM::SOLID_T ) && item->IsFreePad() )
{
// Allow free pads only when already inside pad
if( item->Shape()->Collide( aWhere ) )
{
prioritized[0] = item;
dist[0] = 0;
}
}
else if ( item->Net() == 0 && m_router->Settings().Mode() == RM_MarkObstacles )
{
// Allow unconnected items as last resort in RM_MarkObstacles mode
if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
continue;
if( item->Layers().Overlaps( tl ) )
prioritized[4] = item;
}