diff --git a/pcbnew/router/pns_index.cpp b/pcbnew/router/pns_index.cpp index b50992b2b2..47aed07f48 100644 --- a/pcbnew/router/pns_index.cpp +++ b/pcbnew/router/pns_index.cpp @@ -34,7 +34,7 @@ void INDEX::Add( ITEM* aItem ) for( int i = range.Start(); i <= range.End(); ++i ) { - if( !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aItem, i ) ) + if( !ROUTER::GetInstance()->GetInterface()->IsOnLayer( aItem, i ) ) { if( aItem->AlternateShape() ) m_subIndices[i].Add( aItem, aItem->AlternateShape()->BBox() ); diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp index 913bd535b6..5edea57e72 100644 --- a/pcbnew/router/pns_item.cpp +++ b/pcbnew/router/pns_item.cpp @@ -43,7 +43,7 @@ bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VEC return false; if( !aOther->Layers().IsMultilayer() - && !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aOther->Layer() ) ) + && !ROUTER::GetInstance()->GetInterface()->IsOnLayer( this, aOther->Layer() ) ) { if( !AlternateShape() ) wxLogError @@ -54,7 +54,7 @@ bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VEC } if( !Layers().IsMultilayer() - && !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aOther, Layer() ) ) + && !ROUTER::GetInstance()->GetInterface()->IsOnLayer( aOther, Layer() ) ) { if( !aOther->AlternateShape() ) wxLogError diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 67a019767b..85ba1eedd5 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -894,9 +894,13 @@ bool PNS_KICAD_IFACE::IsAnyLayerVisible( const LAYER_RANGE& aLayer ) } -bool PNS_KICAD_IFACE::IsPadOnLayer( const PNS::ITEM* aItem, int aLayer ) +bool PNS_KICAD_IFACE::IsOnLayer( const PNS::ITEM* aItem, int aLayer ) { - if( !aItem->Parent() || aLayer < 0) + /// Default is all layers + if( aLayer < 0 ) + return true; + + if( !aItem->Parent() ) return aItem->Layers().Overlaps( aLayer ); switch( aItem->Parent()->Type() ) diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index b31aaa06c2..82286ae1fc 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -53,7 +53,7 @@ public: void SetBoard( BOARD* aBoard ); void SyncWorld( PNS::NODE* aWorld ) override; bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) override { return true; }; - bool IsPadOnLayer( const PNS::ITEM* aItem, int aLayer ) override { return true; }; + bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) override { return true; }; bool IsItemVisible( const PNS::ITEM* aItem ) override { return true; } void HideItem( PNS::ITEM* aItem ) override {} void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override {} @@ -106,7 +106,7 @@ public: void EraseView() override; bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) override; bool IsItemVisible( const PNS::ITEM* aItem ) override; - bool IsPadOnLayer( const PNS::ITEM* aItem, int aLayer ) override; + bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) override; void HideItem( PNS::ITEM* aItem ) override; void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override; void Commit() override; diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index f226fb52bb..f68d103429 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -494,7 +494,7 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead ) for( auto& obs : obstacles ) { int cl = m_currentNode->GetClearance( obs.m_item, &newHead ); - auto hull = obs.m_item->Hull( cl, newHead.Width() ); + auto hull = obs.m_item->Hull( cl, newHead.Width(), newHead.Layer() ); auto nearest = hull.NearestPoint( aP ); Dbg()->AddLine( hull, 2, 10000 ); diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index c7c9af827e..9d23dd7022 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -100,7 +100,7 @@ enum DRAG_MODE virtual void RemoveItem( ITEM* aItem ) = 0; virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) = 0; virtual bool IsItemVisible( const PNS::ITEM* aItem ) = 0; - virtual bool IsPadOnLayer( const PNS::ITEM* aItem, int aLayer ) = 0; + virtual bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) = 0; virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1, bool aEdit = false ) = 0; virtual void HideItem( ITEM* aItem ) = 0; virtual void Commit() = 0; diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 5649764b2b..75528bbe89 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -312,7 +312,7 @@ SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, L for( int i = 0; i < n_segs; i++ ) { SEGMENT seg( aCurrent, aCurrent.CSegment( i ) ); - SHAPE_LINE_CHAIN hull = seg.Hull( clearance, w ); + SHAPE_LINE_CHAIN hull = seg.Hull( clearance, w, aObstacle.Layer() ); hulls.push_back( hull ); } diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index 567f0b8aca..99eb780d00 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -38,7 +38,7 @@ const SHAPE_LINE_CHAIN SOLID::Hull( int aClearance, int aWalkaroundThickness, in int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2; SHAPE* shape = m_shape; - if( !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aLayer ) ) + if( !ROUTER::GetInstance()->GetInterface()->IsOnLayer( this, aLayer ) ) { /// The alternate shape is defined for THT pads. If we don't have an alternate shape /// then the solid shape does not exist on this layer diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index 1a8916e1ae..ad32535682 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -76,7 +76,7 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int int cl = ( aClearance + aWalkaroundThickness / 2 ); int width = m_diameter; - if( !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aLayer ) ) + if( !ROUTER::GetInstance()->GetInterface()->IsOnLayer( this, aLayer ) ) width = m_drill; return OctagonalHull( m_pos -