diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index af5e5538c9..924310b8fb 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1048,6 +1048,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem ) return true; } + void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard ) { m_board = aBoard; @@ -1055,6 +1056,19 @@ void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard ) } +bool PNS_KICAD_IFACE::IsAnyLayerVisible( const LAYER_RANGE& aLayer ) +{ + if( !m_view ) + return false; + + for( int i = aLayer.Start(); i <= aLayer.End(); i++ ) + if( m_view->IsLayerVisible( i ) ) + return true; + + return false; +} + + void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld ) { int worstPadClearance = 0; diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 31501bb73e..69e6c5d052 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -52,6 +52,7 @@ public: void SetView( KIGFX::VIEW* aView ); void SyncWorld( PNS::NODE* aWorld ) override; void EraseView() override; + bool IsAnyLayerVisible( const LAYER_RANGE& 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 AddItem( PNS::ITEM* aItem ) override; diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index f5e90f54ee..49e4edb664 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -28,6 +28,7 @@ #include #include +#include #include #include "pns_routing_settings.h" @@ -93,6 +94,7 @@ enum DRAG_MODE virtual void SyncWorld( NODE* aNode ) = 0; virtual void AddItem( ITEM* aItem ) = 0; virtual void RemoveItem( ITEM* aItem ) = 0; + virtual bool IsAnyLayerVisible( const LAYER_RANGE& 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_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 838b2c41b6..7780086dc1 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -137,6 +137,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b if( !IsCopperLayer( item->Layers().Start() ) ) continue; + if( !m_iface->IsAnyLayerVisible( item->Layers() ) ) + continue; + if( std::find( aAvoidItems.begin(), aAvoidItems.end(), item ) != aAvoidItems.end() ) continue;