Plot drill marks on mask layers if the pad exists there.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20859

(cherry picked from commit 5e6ef67fce30849ca746a331cf846d9826a83387)
This commit is contained in:
Jeff Young 2025-05-10 18:15:43 +01:00
parent 3900d8e231
commit 9e17baecbc
4 changed files with 13 additions and 38 deletions

View File

@ -57,8 +57,6 @@
#include <wx/msgdlg.h>
LSET DIALOG_PLOT::s_lastLayerSet;
LSET DIALOG_PLOT::s_lastAllLayersSet;
LSEQ DIALOG_PLOT::s_lastAllLayersOrder;

View File

@ -111,10 +111,6 @@ private:
JOB_EXPORT_PCB_PLOT* m_job;
/// The plot layer set that last time the dialog was opened.
static LSET s_lastLayerSet;
static LSET s_lastAllLayersSet;
/// The plot on all layers ordering the last time the dialog was opened.
static LSEQ s_lastAllLayersOrder;
};

View File

@ -132,30 +132,16 @@ void PlotBoardLayers( BOARD* aBoard, PLOTTER* aPlotter, const LSEQ& aLayers,
if( !aBoard || !aPlotter || aLayers.empty() )
return;
// if a drill mark must be plotted,it must be plotted as a filled
// white shape *after* all other shapes are plotted, provided that
// the other shapes are not copper layers
int copperLayers = 0;
int nonCopperLayers = 0;
for( PCB_LAYER_ID layer : aLayers )
{
if( IsCopperLayer( layer ) )
copperLayers++;
else
nonCopperLayers++;
}
bool plot_mark = ( aPlotOptions.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE
&& copperLayers > 0 && nonCopperLayers > 0 );
for( PCB_LAYER_ID layer : aLayers )
PlotOneBoardLayer( aBoard, aPlotter, layer, aPlotOptions, layer == aLayers[0] );
if( plot_mark )
// Drill marks are plotted in white to knockout the pad if any layers of the pad are
// being plotted, and in black if the pad is not being plotted. For the former, this
// must happen after all other layers are plotted.
if( aPlotOptions.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
{
aPlotter->SetColor( WHITE );
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOptions );
itemplotter.SetLayerSet( aLayers );
itemplotter.PlotDrillMarks();
}
}
@ -256,9 +242,6 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
{
case B_Mask:
case F_Mask:
// Disable plot pad holes
plotOpt.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
// Use outline mode for DXF
plotOpt.SetDXFPlotPolygonMode( true );
@ -841,10 +824,6 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
}
aPlotter->EndBlock( nullptr );
// Adding drill marks, if required and if the plotter is able to plot them:
if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
itemplotter.PlotDrillMarks();
}

View File

@ -1178,8 +1178,7 @@ void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECT
void BRDITEMS_PLOTTER::PlotDrillMarks()
{
bool onCopperLayer = ( LSET::AllCuMask() & m_layerMask ).any();
int smallDrill = 0;
int smallDrill = 0;
if( GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
smallDrill = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize );
@ -1190,11 +1189,11 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
- In HPGL you can't see them
- In gerbers you can't see them, too. This is arguably the right thing to do since having
drill marks and high speed drill stations is a sure recipe for broken tools and angry
manufacturers. If you *really* want them you could start a layer with negative polarity
to knock-out the film.
manufacturers. If you *really* want them you could start a layer with negative
polarity to knock-out the film.
- In DXF they go into the 'WHITE' layer. This could be useful.
*/
if( GetPlotMode() == FILLED && onCopperLayer )
if( GetPlotMode() == FILLED )
m_plotter->SetColor( WHITE );
for( PCB_TRACK* track : m_board->Tracks() )
@ -1221,11 +1220,14 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
if( pad->GetDrillSize().x == 0 )
continue;
if( GetPlotMode() == FILLED )
m_plotter->SetColor( ( pad->GetLayerSet() & m_layerMask ).any() ? WHITE : BLACK );
plotOneDrillMark( pad->GetDrillShape(), pad->GetPosition(), pad->GetDrillSize(),
pad->GetSize( PADSTACK::ALL_LAYERS ), pad->GetOrientation(), smallDrill );
}
}
if( GetPlotMode() == FILLED && onCopperLayer )
if( GetPlotMode() == FILLED )
m_plotter->SetColor( BLACK );
}