diff --git a/kibot/gs.py b/kibot/gs.py index 4fb7b103..21571d9b 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -575,3 +575,22 @@ class GS(object): cmd.insert(1, str(GS.global_kiauto_wait_start)) cmd.insert(1, '--wait_start') return cmd, video_remove + + @staticmethod + 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): + if GS.ki7: + po.SetSvgPrecision(svg_precision) + elif GS.ki6: + po.SetSvgPrecision(svg_precision, False) + # No ki5 equivalent diff --git a/kibot/out_any_layer.py b/kibot/out_any_layer.py index 3bab069f..bc2dbb42 100644 --- a/kibot/out_any_layer.py +++ b/kibot/out_any_layer.py @@ -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, LSET) + PLOT_FORMAT_GERBER, PLOT_FORMAT_POST, PLOT_FORMAT_DXF, PLOT_FORMAT_PDF, PLOT_FORMAT_SVG) from .optionable import Optionable from .out_base import BaseOutput, VariantOptions from .error import PlotError, KiPlotConfigurationError @@ -96,14 +96,7 @@ class AnyLayerOptions(VariantOptions): po.SetPlotValue(self.plot_footprint_values) po.SetPlotInvisibleText(self.force_plot_invisible_refs_vals) # Edge layer included or not - if not GS.ki7: - po.SetExcludeEdgeLayer(self.exclude_edge_layer) - elif not self.exclude_edge_layer: - # Include the edge on all layers - # Doesn't work. A bug? https://gitlab.com/kicad/code/kicad/-/issues/13841 - include = LSET() - include.addLayer(GS.board.GetLayerID('Edge.Cuts')) - po.SetPlotOnAllLayersSelection(include) + GS.SetExcludeEdgeLayer(po, self.exclude_edge_layer) if GS.ki5: po.SetPlotPadsOnSilkLayer(not self.exclude_pads_from_silkscreen) else: diff --git a/kibot/out_pcb_print.py b/kibot/out_pcb_print.py index 88af604f..c6ca983c 100644 --- a/kibot/out_pcb_print.py +++ b/kibot/out_pcb_print.py @@ -1087,11 +1087,10 @@ class PCB_PrintOptions(VariantOptions): pc = PLOT_CONTROLLER(GS.board) po = pc.GetPlotOptions() # Set General Options: - po.SetExcludeEdgeLayer(True) # We plot it separately + GS.SetExcludeEdgeLayer(po, True) # We plot it separately po.SetUseAuxOrigin(False) po.SetAutoScale(False) - if GS.ki6: - po.SetSvgPrecision(self.svg_precision, False) + GS.SetSvgPrecision(po, self.svg_precision) # Helpers for force_edge_cuts if self.force_edge_cuts: edge_layer = LayerOptions.create_layer('Edge.Cuts') diff --git a/kibot/out_svg.py b/kibot/out_svg.py index 1650a961..e3f223ca 100644 --- a/kibot/out_svg.py +++ b/kibot/out_svg.py @@ -54,8 +54,7 @@ class SVGOptions(DrillMarks): if GS.ki5: po.SetLineWidth(FromMM(self.line_width)) po.SetNegative(self.negative_plot) - if GS.ki6: - po.SetSvgPrecision(self.svg_precision, False) + GS.SetSvgPrecision(po, self.svg_precision) def read_vals_from_po(self, po): super().read_vals_from_po(po)