From 2b6d2fc117e6a10e2d9a617f25fa425064e1fd0a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 6 Apr 2023 15:05:48 +0100 Subject: [PATCH] Don't return holes that have a parent pad or via. (While we don't currently have holes without a parent pad or via, you could imagine using HOLEs in the future to represent a hole in a first-class board outline, so better not to build this assumption in.) (cherry picked from commit b18bf092080acf4216ec8bdd1530b11d4d869923) --- pcbnew/router/pns_hole.h | 8 +++++++- pcbnew/router/pns_kicad_iface.cpp | 23 ----------------------- pcbnew/router/pns_node.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/pcbnew/router/pns_hole.h b/pcbnew/router/pns_hole.h index a72b7a52c6..91c8bf6582 100644 --- a/pcbnew/router/pns_hole.h +++ b/pcbnew/router/pns_hole.h @@ -63,7 +63,13 @@ public: BOARD_ITEM* Parent() const override { - return m_parentPadVia ? m_parentPadVia->Parent() : nullptr; + if( m_parent ) + return m_parent; + + if( m_parentPadVia ) + return m_parentPadVia->Parent(); + + return nullptr; } void SetCenter( const VECTOR2I& aCenter ); diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index ee9d50821b..cf3f5fac6e 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -129,8 +129,6 @@ public: void ClearCaches() override; private: - int holeRadius( const PNS::ITEM* aItem ) const; - /** * Checks for netnamed differential pairs. * This accepts nets named suffixed by 'P', 'N', '+', '-', as well as additional @@ -174,27 +172,6 @@ PNS_PCBNEW_RULE_RESOLVER::~PNS_PCBNEW_RULE_RESOLVER() } -int PNS_PCBNEW_RULE_RESOLVER::holeRadius( const PNS::ITEM* aItem ) const -{ - if( aItem->Kind() == PNS::ITEM::SOLID_T ) - { - const PAD* pad = dynamic_cast( aItem->Parent() ); - - if( pad && pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) - return pad->GetDrillSize().x / 2; - } - else if( aItem->Kind() == PNS::ITEM::VIA_T ) - { - const PCB_VIA* via = dynamic_cast( aItem->Parent() ); - - if( via ) - return via->GetDrillValue() / 2; - } - - return 0; -} - - bool PNS_PCBNEW_RULE_RESOLVER::IsDiffPair( const PNS::ITEM* aA, const PNS::ITEM* aB ) { int net_p, net_n; diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index ce55398e5b..591ba3b826 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -1573,13 +1573,15 @@ ITEM *NODE::FindItemByParent( const BOARD_ITEM* aParent ) if( aParent->IsConnected() ) { const BOARD_CONNECTED_ITEM* cItem = static_cast( aParent ); - - INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( cItem->GetNetCode() ); + INDEX::NET_ITEMS_LIST* l_cur = m_index->GetItemsForNet( cItem->GetNetCode() ); if( l_cur ) { for( ITEM* item : *l_cur ) { + if( item->OfKind( PNS::ITEM::HOLE_T ) && static_cast( item )->ParentPadVia() ) + continue; + if( item->Parent() == aParent ) return item; }