From 3d37e19b463360ae86369ea0a4b1b8892cf0c59a Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 13 Jan 2021 16:53:24 -0300 Subject: [PATCH] Skip missing layers with a warning. When using "any layer" outputs. This is needed now that we can specify generic names. --- kibot/misc.py | 1 + kibot/out_any_layer.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kibot/misc.py b/kibot/misc.py index 40f79e67..a801b328 100644 --- a/kibot/misc.py +++ b/kibot/misc.py @@ -161,6 +161,7 @@ W_WRONGPASTE = '(W045) ' W_MISFLDNAME = '(W046) ' W_MISS3D = '(W047) ' W_FAILDL = '(W048) ' +W_NOLAYER = '(W049) ' class Rect(object): diff --git a/kibot/out_any_layer.py b/kibot/out_any_layer.py index e8536945..f051a655 100644 --- a/kibot/out_any_layer.py +++ b/kibot/out_any_layer.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2020 Salvador E. Tropea -# Copyright (c) 2020 Instituto Nacional de TecnologĂ­a Industrial +# Copyright (c) 2020-2021 Salvador E. Tropea +# Copyright (c) 2020-2021 Instituto Nacional de TecnologĂ­a Industrial # Copyright (c) 2018 John Beard # License: GPL-3.0 # Project: KiBot (formerly KiPlot) # Adapted from: https://github.com/johnbeard/kiplot import os -from pcbnew import GERBER_JOBFILE_WRITER, PLOT_CONTROLLER, IsCopperLayer +from pcbnew import GERBER_JOBFILE_WRITER, PLOT_CONTROLLER, IsCopperLayer, F_Cu, B_Cu, Edge_Cuts from .out_base import (BaseOutput) from .error import (PlotError, KiPlotConfigurationError) from .layer import Layer from .gs import GS -from .misc import KICAD_VERSION_5_99 +from .misc import KICAD_VERSION_5_99, W_NOLAYER from .out_base import VariantOptions from .macros import macros, document # noqa: F401 from . import log @@ -90,6 +90,9 @@ class AnyLayerOptions(VariantOptions): suffix = la.suffix desc = la.description id = la.id + if not GS.board.IsLayerEnabled(id): + logger.warning(W_NOLAYER+'Layer "{}" isn\'t used'.format(desc)) + continue # Set current layer plot_ctrl.SetLayer(id) # Skipping NPTH is controlled by whether or not this is