7.0.2 Scripting PDF plot: Colored plots and edge.cuts on same page

Hi everyone.

EDIT: First Question answered:
Right after I posted this and reread my code I found the solution to plot multiple layers on one page… Simply, call PLOT_CONTROLLER.SetLayer(…) and PLOT_CONTROLLER.PlotLayer() again.

    if plot_controller.PlotLayer() == False:
        print("plot error")

    if plot_controller.PlotLayer() == False:
        print("plot error")

— End of edit —

I am writing a small script, to export all data for review and manufacturing. My starting point was ./demos/python_scripts_examples/plot_board.py

I want to get a colored output and the Edge.cuts layer should be plotted as well. After searching through the pcbnew.py lib and ./pcbnew/pcb_plot_params.h I found the function PCB_PLOT_PARAMS.SetPlotOnAllLayersSelection(...), and tried to set the edge cuts layer in there:

    selected_layers = pcbnew.LSET()

But this did not give the expected result. Can anyone point me in the right direction?

Also I would like to get colored output and I could not find the correct function for this. Any ideas?

Thanks for reading so far,

Have you looked at my plugin called Board2Pdf? It does just what you ask for (I think). I don’t think it’s possible to get colored pdfs plotted from KiCad. My solution is to plot each layer in black and then change the color and combine the layers to one pdf.

You could also print to pdf instead of plotting, but you lose information such as ability to search in the pdf.

Board2Pdf is available in the Plugin and Content manager. I will also release a new version soon.