From ed2148d6344697826f727a1b569362f15f388d54 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 17 Feb 2022 19:43:04 -0800 Subject: [PATCH] Prevent merging tracks across pads When merging co-linear tracks, we should maintain the existing break if it exists on pads, vias and other connection points (cherry picked from commit 3a29d94c0a634088e53e9d1f50ec9e08fada5a20) --- pcbnew/tracks_cleaner.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 42cfd1d128..008609ecaf 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -540,6 +540,19 @@ bool TRACKS_CLEANER::mergeCollinearSegments( PCB_TRACK* aSeg1, PCB_TRACK* aSeg2 } } + // Now find the removed end(s) and stop merging if it is a node: + if( aSeg1->GetStart() != dummy_seg.GetStart() && aSeg1->GetStart() != dummy_seg.GetEnd() ) + { + if( testTrackEndpointIsNode( aSeg1, true ) ) + return false; + } + + if( aSeg1->GetEnd() != dummy_seg.GetStart() && aSeg1->GetEnd() != dummy_seg.GetEnd() ) + { + if( testTrackEndpointIsNode( aSeg1, false ) ) + return false; + } + std::shared_ptr item = std::make_shared( CLEANUP_MERGE_TRACKS ); item->SetItems( aSeg1, aSeg2 ); m_itemsList->push_back( item );