[Any Layer][KiCad 7] Added support for Edge.Cuts inclusion

- Should be available in KiCad 7.0.1
- Was bug 13841, now closed
This commit is contained in:
Salvador E. Tropea 2023-02-16 09:19:33 -03:00
parent 28ef08c00a
commit d15a97f02e
3 changed files with 18 additions and 9 deletions

View File

@ -612,12 +612,6 @@ class GS(object):
def SetExcludeEdgeLayer(po, exclude_edge_layer):
if not GS.ki7:
po.SetExcludeEdgeLayer(exclude_edge_layer)
elif not exclude_edge_layer:
# Include the edge on all layers
# Doesn't work in 7.0.0. Bug: https://gitlab.com/kicad/code/kicad/-/issues/13841
include = pcbnew.LSET()
include.addLayer(GS.board.GetLayerID('Edge.Cuts'))
po.SetPlotOnAllLayersSelection(include)
@staticmethod
def SetSvgPrecision(po, svg_precision):

View File

@ -8,7 +8,7 @@
import os
import re
from pcbnew import (GERBER_JOBFILE_WRITER, PLOT_CONTROLLER, IsCopperLayer, F_Cu, B_Cu, Edge_Cuts, PLOT_FORMAT_HPGL,
PLOT_FORMAT_GERBER, PLOT_FORMAT_POST, PLOT_FORMAT_DXF, PLOT_FORMAT_PDF, PLOT_FORMAT_SVG)
PLOT_FORMAT_GERBER, PLOT_FORMAT_POST, PLOT_FORMAT_DXF, PLOT_FORMAT_PDF, PLOT_FORMAT_SVG, LSEQ)
from .optionable import Optionable
from .out_base import BaseOutput, VariantOptions
from .error import PlotError, KiPlotConfigurationError
@ -124,6 +124,17 @@ class AnyLayerOptions(VariantOptions):
filename = os.path.splitext(filename)[0]+os.path.splitext(filename)[1].upper()
return filename
def plot_layer(self, plot_ctrl, id):
if GS.ki7 and not self.exclude_edge_layer:
# In KiCad 7 this is not an option, but we can plot more than one layer
# Note that this needs KiCad 7.0.1 or newer
seq = LSEQ()
seq.push_back(Edge_Cuts)
seq.push_back(id)
plot_ctrl.PlotLayers(seq)
return
plot_ctrl.PlotLayer()
def run(self, output_dir, layers):
super().run(output_dir)
# Apply the variants and filters
@ -164,7 +175,7 @@ class AnyLayerOptions(VariantOptions):
k_filename = plot_ctrl.GetPlotFileName()
filename = self.compute_name(k_filename, output_dir, self.output, id, suffix)
logger.debug("Plotting layer `{}` to `{}`".format(la, filename))
plot_ctrl.PlotLayer()
self.plot_layer(plot_ctrl, id)
plot_ctrl.ClosePlot()
if self.output and k_filename != filename:
os.replace(k_filename, filename)

View File

@ -97,7 +97,11 @@ def test_gerber_2layer(test_dir):
r"C,1.000000"])
# Expect a flash for the square pad
ctx.expect_gerber_flash_at(f_cu, 5, (140, -100))
if context.ki7():
# Is this a bug?
ctx.expect_gerber_flash_at(f_cu, 5, (139.99999, -100))
else:
ctx.expect_gerber_flash_at(f_cu, 5, (140, -100))
ctx.clean_up()