From 8792d7288d13eb315ee02187ee6d9332243f54f6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 20 Apr 2021 20:03:26 -0400 Subject: [PATCH] Net inspector: Fix calculation of via length We have a function for this in the BOARD_STACKUP now, and it returns a more correct number (excluding the start and end copper layers) Fixes https://gitlab.com/kicad/code/kicad/-/issues/8256 --- pcbnew/dialogs/dialog_net_inspector.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/pcbnew/dialogs/dialog_net_inspector.cpp b/pcbnew/dialogs/dialog_net_inspector.cpp index 950e88c949..f99b97ae58 100644 --- a/pcbnew/dialogs/dialog_net_inspector.cpp +++ b/pcbnew/dialogs/dialog_net_inspector.cpp @@ -1373,23 +1373,7 @@ unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const TRACK* aTrack ) con if( bds.m_HasStackup ) { const BOARD_STACKUP& stackup = bds.GetStackupDescriptor(); - - std::pair layer_dist[2] = { std::make_pair( via.TopLayer(), 0 ), - std::make_pair( via.BottomLayer(), 0 ) }; - - for( const BOARD_STACKUP_ITEM* i : stackup.GetList() ) - { - for( std::pair& j : layer_dist ) - { - if( j.first != UNDEFINED_LAYER ) - j.second += i->GetThickness(); - - if( j.first == i->GetBrdLayerId() ) - j.first = UNDEFINED_LAYER; - } - } - - return std::abs( layer_dist[0].second - layer_dist[1].second ); + return stackup.GetLayerDistance( via.TopLayer(), via.BottomLayer() ); } else {