From d6a121d617b4d27e17ecfa6952e5ad58416fc785 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 18 May 2024 21:51:09 +0000 Subject: [PATCH] Don't drag multiple coincident vias Fixes https://gitlab.com/kicad/code/kicad/-/issues/17915 (cherry picked from commit 7a3db2d176a8e41284a7bf6dafa98139cc6a5cad) Co-authored-by: Jon Evans --- pcbnew/router/pns_dragger.cpp | 8 +++++++- pcbnew/router/pns_index.h | 2 ++ pcbnew/router/pns_item.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index bad99cf114..83eda1d7ca 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -196,6 +196,8 @@ const ITEM_SET DRAGGER::findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& h if( !jt ) return rv; + bool foundVia = false; + for( ITEM* item : jt->LinkList() ) { if( item->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) ) @@ -211,7 +213,11 @@ const ITEM_SET DRAGGER::findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& h } else if( item->OfKind( ITEM::VIA_T ) ) { - rv.Add( item ); + if( !foundVia ) + { + rv.Add( item ); + foundVia = true; + } } } diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index b1f2a2b37d..2ec077ebb0 100644 --- a/pcbnew/router/pns_index.h +++ b/pcbnew/router/pns_index.h @@ -142,6 +142,8 @@ int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) const { int total = 0; + wxCHECK( aItem->Kind() != ITEM::INVALID_T, 0 ); + const LAYER_RANGE& layers = aItem->Layers(); for( int i = layers.Start(); i <= layers.End(); ++i ) diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index c5b3a75f32..095d71da06 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -99,6 +99,7 @@ public: ///< Supported item types enum PnsKind { + INVALID_T = 0, SOLID_T = 1, LINE_T = 2, JOINT_T = 4,