Use legacy boardThickness for via length when we don't have a stackup

This commit is contained in:
Jeff Young 2020-11-14 21:22:35 +00:00
parent 61bca4aaa4
commit 6e6f6a2d72
1 changed files with 33 additions and 15 deletions

View File

@ -1337,27 +1337,45 @@ void DIALOG_NET_INSPECTOR::updateNet( NETINFO_ITEM* aNet )
unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const TRACK* aTrack ) const unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const TRACK* aTrack ) const
{ {
const VIA& via = dynamic_cast<const VIA&>( *aTrack ); const VIA& via = dynamic_cast<const VIA&>( *aTrack );
BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings();
// calculate the via length individually from the board stackup and // calculate the via length individually from the board stackup and via's start and end layer.
// via's start and end layer. if( bds.m_HasStackup )
const BOARD_STACKUP& stackup = m_brd->GetDesignSettings().GetStackupDescriptor();
std::pair<PCB_LAYER_ID, int> 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<PCB_LAYER_ID, int>& j : layer_dist ) const BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
std::pair<PCB_LAYER_ID, int> layer_dist[2] = { std::make_pair( via.TopLayer(), 0 ),
std::make_pair( via.BottomLayer(), 0 ) };
for( const BOARD_STACKUP_ITEM* i : stackup.GetList() )
{ {
if( j.first != UNDEFINED_LAYER ) for( std::pair<PCB_LAYER_ID, int>& j : layer_dist )
j.second += i->GetThickness(); {
if( j.first != UNDEFINED_LAYER )
j.second += i->GetThickness();
if( j.first == i->GetBrdLayerId() ) if( j.first == i->GetBrdLayerId() )
j.first = UNDEFINED_LAYER; j.first = UNDEFINED_LAYER;
}
} }
}
return std::abs( layer_dist[0].second - layer_dist[1].second ); return std::abs( layer_dist[0].second - layer_dist[1].second );
}
else
{
int dielectricLayers = bds.GetCopperLayerCount() - 1;
int layerThickness = bds.GetBoardThickness() / dielectricLayers;
int effectiveBottomLayer;
if( via.BottomLayer() == B_Cu )
effectiveBottomLayer = F_Cu + dielectricLayers;
else
effectiveBottomLayer = via.BottomLayer();
int layerCount = effectiveBottomLayer - via.TopLayer();
return layerCount * layerThickness;
}
} }