From 284b9df12aaa5fdf808e885c6dc82e24c1e8dbb1 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 28 Dec 2022 13:06:39 -0300 Subject: [PATCH] [Any Layer][Added] Support for sketch_pads_on_fab_layers Related to #356 --- CHANGELOG.md | 2 ++ README.md | 14 ++++++++++++++ docs/samples/generic_plot.kibot.yaml | 24 ++++++++++++++++++++++++ kibot/gs.py | 4 ++++ kibot/out_any_layer.py | 11 +++++++++++ tests/yaml_samples/ps.kibot.yaml | 2 ++ 6 files changed, 57 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0b7330..5d8a28bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `vrml` export the 3D model in Virtual Reality Modeling Language (#349) - iBoM: - `hide_excluded` to hide excluded *.Fab drawings. +- Plot related outputs: + - Added support for the KiCad 6 "sketch_pads_on_fab_layers" option. (#356) ### Fixed - PCB_Print: - Images not showing in custom frames. (#352) diff --git a/README.md b/README.md index 6fbd5482..46f0bb4e 100644 --- a/README.md +++ b/README.md @@ -1913,6 +1913,8 @@ Notes: You must disable it to get the dimensions (See https://gitlab.com/kicad/code/kicad/-/issues/11901). - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `sketch_plot`: [boolean=false] Don't fill objects, just draw the outline. - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. @@ -2090,6 +2092,8 @@ Notes: - `plot_footprint_values`: [boolean=true] Include the footprint values. - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. - `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates. @@ -2153,6 +2157,8 @@ Notes: - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. - `scaling`: [number=0] Scale factor (0 means autoscaling). + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `sketch_plot`: [boolean=false] Don't fill objects, just draw the outline. - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. @@ -3190,6 +3196,8 @@ Notes: - `plot_footprint_values`: [boolean=true] Include the footprint values. - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. - `variant`: [string=''] Board variant to apply. @@ -3229,6 +3237,8 @@ Notes: - `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs. - `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested. + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. - `variant`: [string=''] Board variant to apply. @@ -3487,6 +3497,8 @@ Notes: A short-cut to use for simple cases where a variant is an overkill. - `scale_adjust_x`: [number=1.0] Fine grain adjust for the X scale (floating point multiplier). - `scale_adjust_y`: [number=1.0] Fine grain adjust for the Y scale (floating point multiplier). + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `sketch_plot`: [boolean=false] Don't fill objects, just draw the outline. - `tent_vias`: [boolean=true] Cover the vias. - `uppercase_extensions`: [boolean=false] Use uppercase names for the extensions. @@ -3884,6 +3896,8 @@ Notes: - `plot_footprint_values`: [boolean=true] Include the footprint values. - `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. + - `sketch_pad_line_width`: [number=0.1] Line width for the sketched pads [mm] (KiCad 6+). + - `sketch_pads_on_fab_layers`: [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+). - `svg_precision`: [number=4] [0,6] Scale factor used to represent 1 mm in the SVG (KiCad 6). The value is how much zeros has the multiplier (1 mm = 10 power `svg_precision` units). Note that for an A4 paper Firefox 91 and Chrome 105 can't handle more than 5. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 8c4419d1..229fcad6 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -653,6 +653,10 @@ outputs: # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. # A short-cut to use for simple cases where a variant is an overkill pre_transform: '_none' + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [boolean=false] Don't fill objects, just draw the outline sketch_plot: false # [boolean=true] Cover the vias @@ -812,6 +816,10 @@ outputs: # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. # A short-cut to use for simple cases where a variant is an overkill pre_transform: '_none' + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [boolean=false] Subtract the solder mask from the silk screen subtract_mask_from_silk: false # [boolean=true] Cover the vias @@ -886,6 +894,10 @@ outputs: pre_transform: '_none' # [number=0] Scale factor (0 means autoscaling) scaling: 0 + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [boolean=false] Don't fill objects, just draw the outline sketch_plot: false # [boolean=true] Cover the vias @@ -2127,6 +2139,10 @@ outputs: # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. # A short-cut to use for simple cases where a variant is an overkill pre_transform: '_none' + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [boolean=true] Cover the vias tent_vias: true # [boolean=false] Use uppercase names for the extensions @@ -2369,6 +2385,10 @@ outputs: scale_adjust_y: 1.0 # [number=1] Scale factor (0 means autoscaling) scaling: 1 + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [boolean=false] Don't fill objects, just draw the outline sketch_plot: false # [boolean=true] Cover the vias @@ -2769,6 +2789,10 @@ outputs: # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters. # A short-cut to use for simple cases where a variant is an overkill pre_transform: '_none' + # [number=0.1] Line width for the sketched pads [mm] (KiCad 6+) + sketch_pad_line_width: 0.1 + # [boolean=false] Draw only the outline of the pads on the *.Fab layers (KiCad 6+) + sketch_pads_on_fab_layers: false # [number=4] [0,6] Scale factor used to represent 1 mm in the SVG (KiCad 6). # The value is how much zeros has the multiplier (1 mm = 10 power `svg_precision` units). # Note that for an A4 paper Firefox 91 and Chrome 105 can't handle more than 5 diff --git a/kibot/gs.py b/kibot/gs.py index c2fb89c3..d8f712fb 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -303,6 +303,10 @@ class GS(object): return layers.Contains(id) return id in layers.Seq() + @staticmethod + def from_mm(val): + return int(val*pcbnew.IU_PER_MM) + @staticmethod def expand_text_variables(text, extra_vars=None): vars = GS.load_pro_variables() diff --git a/kibot/out_any_layer.py b/kibot/out_any_layer.py index 3c2bf876..7152eaf3 100644 --- a/kibot/out_any_layer.py +++ b/kibot/out_any_layer.py @@ -75,12 +75,17 @@ class AnyLayerOptions(VariantOptions): """ Used to configure the edge cuts layer extension for Protel mode. Include the dot """ self.custom_reports = CustomReport """ [list(dict)] A list of customized reports for the manufacturer """ + self.sketch_pads_on_fab_layers = False + """ Draw only the outline of the pads on the *.Fab layers (KiCad 6+) """ + self.sketch_pad_line_width = 0.1 + """ Line width for the sketched pads [mm], see `sketch_pads_on_fab_layers` (KiCad 6+) """ super().__init__() def config(self, parent): super().config(parent) if isinstance(self.custom_reports, type): self.custom_reports = [] + self.sketch_pad_line_width = GS.from_mm(self.sketch_pad_line_width) def _configure_plot_ctrl(self, po, output_dir): logger.debug("Configuring plot controller for output") @@ -92,6 +97,9 @@ class AnyLayerOptions(VariantOptions): po.SetExcludeEdgeLayer(self.exclude_edge_layer) if GS.ki5: po.SetPlotPadsOnSilkLayer(not self.exclude_pads_from_silkscreen) + else: + po.SetSketchPadsOnFabLayers(self.sketch_pads_on_fab_layers) + po.SetSketchPadLineWidth(self.sketch_pad_line_width) po.SetPlotViaOnMaskLayer(not self.tent_vias) # Only useful for gerber outputs po.SetCreateGerberJobFile(False) @@ -226,6 +234,9 @@ class AnyLayerOptions(VariantOptions): if GS.ki5: # padsonsilk self.exclude_pads_from_silkscreen = not po.GetPlotPadsOnSilkLayer() + else: + self.sketch_pads_on_fab_layers = po.GetSketchPadsOnFabLayers() + self.sketch_pad_line_width = po.GetSketchPadLineWidth() class AnyLayer(BaseOutput): diff --git a/tests/yaml_samples/ps.kibot.yaml b/tests/yaml_samples/ps.kibot.yaml index b5f56ddd..2e8d7bec 100644 --- a/tests/yaml_samples/ps.kibot.yaml +++ b/tests/yaml_samples/ps.kibot.yaml @@ -15,6 +15,8 @@ outputs: plot_footprint_values: true force_plot_invisible_refs_vals: false tent_vias: true + sketch_pads_on_fab_layers: true + sketch_pad_line_width: 0.1 # PS options line_width: 0.15