From 5da35d775034d8c319740ac857c88370da17896c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 22 Oct 2023 17:06:15 +0100 Subject: [PATCH] Don't modify dp-tuning when doing skew tuning. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15901 --- pcbnew/generators/pcb_tuning_pattern.cpp | 9 +++++---- pcbnew/router/pns_joint.h | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index e19ac85121..e6602db640 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -679,7 +679,7 @@ static std::optional getPNSLine( const VECTOR2I& aStart, const VECTOR if( !startItem || !endItem ) return std::nullopt; - PNS::LINE line = world->AssembleLine( startItem, nullptr, false, true ); + PNS::LINE line = world->AssembleLine( startItem ); SHAPE_LINE_CHAIN oldChain = line.CLine(); wxCHECK( line.ContainsLink( endItem ), std::nullopt ); @@ -711,7 +711,7 @@ bool PCB_TUNING_PATTERN::initBaseLine( PNS::ROUTER* aRouter, int aLayer, BOARD* if( !startItem || !endItem || startSnapPoint == endSnapPoint ) return false; - PNS::LINE line = world->AssembleLine( startItem, nullptr, false, true ); + PNS::LINE line = world->AssembleLine( startItem ); const SHAPE_LINE_CHAIN& chain = line.CLine(); wxASSERT( line.ContainsLink( endItem ) ); @@ -1034,6 +1034,7 @@ void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, PNS::ROUTER* router = aTool->Router(); SHAPE_LINE_CHAIN bounds = getRectShape(); PICKED_ITEMS_LIST groupUndoList; + int epsilon = aBoard->GetDesignSettings().GetDRCEpsilon(); if( router->RoutingInProgress() ) { @@ -1060,8 +1061,8 @@ void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, { PCB_TRACK* track = dynamic_cast( item ); - if( track && bounds.PointInside( track->GetPosition(), 2 ) - && bounds.PointInside( track->GetEnd(), 2 ) ) + if( track && bounds.PointInside( track->GetPosition(), epsilon ) + && bounds.PointInside( track->GetEnd(), epsilon ) ) { AddItem( item ); groupUndoList.PushItem( ITEM_PICKER( nullptr, item, UNDO_REDO::REGROUP ) ); diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index fbfd194456..e81ed76377 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -105,6 +105,9 @@ public: LINKED_ITEM* seg1 = static_cast( m_linkedItems[0] ); LINKED_ITEM* seg2 = static_cast( m_linkedItems[1] ); + if( !aAllowLockedSegs && ( seg1->IsLocked() || seg2->IsLocked() ) ) + return false; + // joints between segments of different widths are not considered trivial. return seg1->Width() == seg2->Width(); }