Use half copper thickness as the thickness of the start and end of vias
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8384
This commit is contained in:
parent
64c76d8067
commit
5157c6c3b9
|
@ -712,6 +712,7 @@ int BOARD_STACKUP::GetLayerDistance( PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSec
|
||||||
|
|
||||||
int total = 0;
|
int total = 0;
|
||||||
bool start = false;
|
bool start = false;
|
||||||
|
bool half = false;
|
||||||
|
|
||||||
for( BOARD_STACKUP_ITEM* item : m_list )
|
for( BOARD_STACKUP_ITEM* item : m_list )
|
||||||
{
|
{
|
||||||
|
@ -725,17 +726,25 @@ int BOARD_STACKUP::GetLayerDistance( PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSec
|
||||||
if( !start && ( layer != UNDEFINED_LAYER && layer >= aFirstLayer ) )
|
if( !start && ( layer != UNDEFINED_LAYER && layer >= aFirstLayer ) )
|
||||||
{
|
{
|
||||||
start = true;
|
start = true;
|
||||||
continue;
|
half = true;
|
||||||
}
|
}
|
||||||
else if( !start )
|
else if( !start )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Reached the stop copper layer? we're done
|
// Reached the stop copper layer? we're done
|
||||||
if( start && ( layer != UNDEFINED_LAYER && layer >= aSecondLayer ) )
|
if( start && ( layer != UNDEFINED_LAYER && layer >= aSecondLayer ) )
|
||||||
break;
|
half = true;
|
||||||
|
|
||||||
for( int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
|
for( int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
|
||||||
total += item->GetThickness( sublayer );
|
{
|
||||||
|
int subThickness = item->GetThickness( sublayer );
|
||||||
|
total += half ? ( subThickness / 2 ) : subThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
half = false;
|
||||||
|
|
||||||
|
if( layer != UNDEFINED_LAYER && layer >= aSecondLayer )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
|
|
|
@ -277,7 +277,12 @@ public:
|
||||||
* Calculate the distance (height) between the two given copper layers.
|
* Calculate the distance (height) between the two given copper layers.
|
||||||
*
|
*
|
||||||
* This factors in the thickness of any dielectric and copper layers between the two given
|
* This factors in the thickness of any dielectric and copper layers between the two given
|
||||||
* layers, but not the height of the given copper layers.
|
* layers, and half the height of the given start and end layers. This half-height calculation
|
||||||
|
* allows this to be used for consistent length measurements when calculating net length through
|
||||||
|
* a series of vias. A more advanced algorithm would be possible once we have a good concept of
|
||||||
|
* the start and end for a length measurment, but for now this will do.
|
||||||
|
* See https://gitlab.com/kicad/code/kicad/-/issues/8384 for more background.
|
||||||
|
*
|
||||||
* @param aFirstLayer is a copper layer
|
* @param aFirstLayer is a copper layer
|
||||||
* @param aSecondLayer is a different copper layer
|
* @param aSecondLayer is a different copper layer
|
||||||
* @return the height (in IU) between the two layers
|
* @return the height (in IU) between the two layers
|
||||||
|
|
Loading…
Reference in New Issue