From ab4535f01b29e0c56e3ca22dcb9e7720ee92c4c5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 11 Jul 2023 11:07:37 +0200 Subject: [PATCH] Pcbnew, show solder mask on VIAS: refinement: take in account the mask expansion. --- pcbnew/pcb_painter.cpp | 11 +++++++++++ pcbnew/pcb_track.cpp | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index c64fd88c4c..a399bf1dac 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -994,6 +994,17 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer ) m_gal->SetIsFill( true ); m_gal->DrawCircle( center, getViaDrillSize( aVia ) / 2.0 ); } + else if( ( aLayer == F_Mask && aVia->IsOnLayer( F_Mask ) ) + || ( aLayer == B_Mask && aVia->IsOnLayer( B_Mask ) ) ) + { + int margin = board->GetDesignSettings().m_SolderMaskExpansion; + + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); + + m_gal->SetLineWidth( margin ); + m_gal->DrawCircle( center, ( aVia->GetWidth() + margin ) / 2.0 ); + } else if( aLayer == LAYER_VIA_THROUGH || m_pcbSettings.IsPrinting() ) { int annular_width = ( aVia->GetWidth() - getViaDrillSize( aVia ) ) / 2.0; diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index a5af6f271a..1bfa127818 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -761,6 +761,14 @@ void PCB_VIA::ViewGetLayers( int aLayers[], int& aCount ) const if( IsLocked() ) aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW; + + // Vias can also be on a solder mask layer. They are on these layers or not, + // depending on the plot and solder mask options + if( IsOnLayer( F_Mask ) ) + aLayers[ aCount++ ] = F_Mask; + + if( IsOnLayer( B_Mask ) ) + aLayers[ aCount++ ] = B_Mask; }