From dc56678289dc4373141cca92d32157449372b82f Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 13 Jun 2019 17:45:24 +0100 Subject: [PATCH] Make DXF monochrome output only contain Black layer Fixes: lp:1832359 * https://bugs.launchpad.net/kicad/+bug/1832359 --- common/plotters/DXF_plotter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index 0a08f3b103..9f721e661a 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -330,6 +330,11 @@ bool DXF_PLOTTER::StartPlot() style_name[i], i < 2 ? 0 : DXF_OBLIQUE_ANGLE ); } + EDA_COLOR_T numLayers = NBCOLORS; + + // If printing in monochrome, only output the black layer + if( !GetColorMode() ) + numLayers = static_cast( 1 ); // Layer table - one layer per color fprintf( outputFile, @@ -340,7 +345,7 @@ bool DXF_PLOTTER::StartPlot() " 2\n" "LAYER\n" " 70\n" - "%d\n", NBCOLORS ); + "%d\n", numLayers ); /* The layer/colors palette. The acad/DXF palette is divided in 3 zones: @@ -349,7 +354,7 @@ bool DXF_PLOTTER::StartPlot() - Greys (251 - 255) */ - for( EDA_COLOR_T i = BLACK; i < NBCOLORS; i = NextColor(i) ) + for( EDA_COLOR_T i = BLACK; i < numLayers; i = NextColor(i) ) { fprintf( outputFile, " 0\n"