How to plot colored output via Python Scripting?

I’m using the following piece of Python script to generate a colored output:

from pcbnew import *

filename=sys.argv[1]
board = LoadBoard(filename)

pctl = PLOT_CONTROLLER(board)

popt = pctl.GetPlotOptions()

pctl.SetLayer(F_Cu)
pctl.SetColorMode(True)
popt.SetColor(COLOR4D(0.050, 0.050, 0.050, 0.1))  # <= Somewhat undocumented!
pctl.OpenPlotfile("layer-F_Cu", PLOT_FORMAT_SVG, "Top Layer")
pctl.PlotLayer()

and expecting a SVG output painted by a color (possibly kind of gray) but definitely other than black, but result is exactly black.

How can I change the output color of a specific layer?

5 posts were split to a new topic: Print layout to pdf

Only one that I think might know is @mmccoo , he’s got a blog about python scripting in KiCAD.

Here is my workaround and its result:

1 Like