From 0f7fbc411a2a5fa91457c50736e46adbdeed11ca Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 14 Feb 2023 09:49:20 -0500 Subject: [PATCH] Allow plotting of multiple board layers per plot in Python. Since the always plot the edge cuts layer option was deprecate, the ability to plot multiple board layers was exposed through the PLOT_CONTROLLER object. Added the interactive plot information which was overlooked during version 7 development. Fixes https://gitlab.com/kicad/code/kicad/-/issues/13841 (cherry picked from commit eb83f76bff39ced8f9911faaef58998a8a13203f) --- pcbnew/pcbplot.cpp | 15 +++++++++++++++ pcbnew/plotcontroller.h | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index d8788da573..69f13663be 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -489,7 +489,22 @@ bool PLOT_CONTROLLER::PlotLayer() // Fully delegated to the parent PlotOneBoardLayer( m_board, m_plotter, ToLAYER_ID( GetLayer() ), GetPlotOptions() ); + PlotInteractiveLayer( m_board, m_plotter ); + return true; +} + +bool PLOT_CONTROLLER::PlotLayers( const LSEQ& aLayerSequence ) +{ + LOCALE_IO toggle; + + // No plot open, nothing to do... + if( !m_plotter ) + return false; + + // Fully delegated to the parent + PlotBoardLayers( m_board, m_plotter, aLayerSequence, GetPlotOptions() ); + PlotInteractiveLayer( m_board, m_plotter ); return true; } diff --git a/pcbnew/plotcontroller.h b/pcbnew/plotcontroller.h index 090313c13b..c2754507bf 100644 --- a/pcbnew/plotcontroller.h +++ b/pcbnew/plotcontroller.h @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Lorenzo Marcantonio, * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -88,6 +88,15 @@ public: */ bool PlotLayer(); + /** + * Plot a sequence of board layer IDs in the given order. + * + * @param aLayerSequence is the sequence of layer IDs to plot. + * + * @return true if the layers plotted correctly othewise false. + */ + bool PlotLayers( const LSEQ& aLayerSequence ); + /** * @return the current plot full filename, set by OpenPlotfile */ @@ -111,6 +120,8 @@ public: */ bool GetColorMode(); + PLOTTER* GetPlotter() { return m_plotter; } + private: int m_plotLayer; PCB_PLOT_PARAMS m_plotOptions;