From 52bfdb97036192226773b9145e27251f47eb3c79 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 12 Jan 2020 11:07:32 -0800 Subject: [PATCH] PNS: Assume the current line is a base before optimizing We use the cost of the current line before trying to improve the pad breakout cost when optimizing the smart pads Fixes #3759 | https://gitlab.com/kicad/code/kicad/issues/3759 --- pcbnew/router/pns_optimizer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index 896c2f3810..93fc3caf0f 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -903,11 +903,12 @@ int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVert // but given two, equally valid costs, we want to pick the longer pad exit. The logic // here is that if the pad is oblong, the track should not exit the shorter side and parallel // the pad but should follow the pad's preferential direction before exiting. - int min_cost = INT_MAX; - long long int max_length = 0; + // The baseline guess is to start with the existing line the user has drawn. + int min_cost = COST_ESTIMATOR::CornerCost( *aLine ); + long long int max_length = 0; + bool found = false; + int p_best = -1; SHAPE_LINE_CHAIN l_best; - bool found = false; - int p_best = -1; for( RtVariant& vp : variants ) {