diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index d02a081f9a..23e63d54d6 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -118,8 +118,8 @@ public: return SHAPE_LINE_CHAIN(); } - virtual const SHAPE_LINE_CHAIN HoleHull( int aClearance, int aWalkaroundThickness, - int aLayer ) const + virtual const SHAPE_LINE_CHAIN HoleHull( int aClearance, int aWalkaroundThickness = 0, + int aLayer = -1 ) const { return SHAPE_LINE_CHAIN(); } diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index 783f2e1e01..94aaa34666 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -77,12 +77,23 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int int width = m_diameter; if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) ) - width = m_drill; + width = m_hole.GetRadius() * 2; // Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ), VECTOR2I( width, width ), - cl + 1, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) ); + cl, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) ); +} + + +const SHAPE_LINE_CHAIN VIA::HoleHull( int aClearance, int aWalkaroundThickness, int aLayer ) const +{ + int cl = ( aClearance + aWalkaroundThickness / 2 ); + int width = m_hole.GetRadius() * 2; + + // Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon + return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ), VECTOR2I( width, width ), cl, + ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) ); } diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index a67fa36470..127b52b082 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -140,6 +140,9 @@ public: const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0, int aLayer = -1 ) const override; + const SHAPE_LINE_CHAIN HoleHull( int aClearance = 0, int aWalkaroundThickness = 0, + int aLayer = -1 ) const override; + virtual VECTOR2I Anchor( int n ) const override { return m_pos;