From db6fa6767ad5a0712791b762cd90d25c576c5a03 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 10 Jan 2023 15:05:05 -0300 Subject: [PATCH] [DOCs][Fixed] annotate_pcb docs and example - Missing options in docs - Wrong example Fixes #360 --- CHANGELOG.md | 3 +++ README.md | 16 ++++++++++++++++ docs/samples/generic_plot.kibot.yaml | 20 ++++++++++---------- kibot/pre_annotate_pcb.py | 28 ++++++++++++++++------------ 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26900d62..0df490d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Problems on KiCad 5 (no 3rd party dir) (#357) - BoM: - pre_transform filers can't be logic filters +- DOCs + - annotate_pcb pre-flight missing options (#360) + - annotate_pcb pre-flight wrong example (#360) ## [1.5.1] - 2022-12-16 ### Fixed diff --git a/README.md b/README.md index 057dfa2b..62adf2fd 100644 --- a/README.md +++ b/README.md @@ -400,6 +400,22 @@ This section is used to specify tasks that will be executed before generating an This preflight modifies the PCB and schematic, use it only in revision control environments. Used to assign references according to footprint coordinates. The project must be fully annotated first. + * Valid keys: + - `bottom_main_ascending`: [boolean=true] Sort the main axis in ascending order for the bottom layer. + For X this is left to right and for Y top to bottom. + - `bottom_main_axis`: [string='y'] [x,y] Use this axis as main sorting criteria for the bottom layer. + - `bottom_secondary_ascending`: [boolean=true] Sort the secondary axis in ascending order for the bottom layer. + For X this is left to right and for Y top to bottom. + - `bottom_start`: [number=101] First number for references at the bottom layer. + Use -1 to continue from the last top reference. + - `grid`: [number=1.0] Grid size in millimeters. + - `top_main_ascending`: [boolean=true] Sort the main axis in ascending order for the top layer. + For X this is left to right and for Y top to bottom. + - `top_main_axis`: [string='y'] [x,y] Use this axis as main sorting criteria for the top layer. + - `top_secondary_ascending`: [boolean=true] Sort the secondary axis in ascending order for the top layer. + For X this is left to right and for Y top to bottom. + - `top_start`: [number=1] First number for references at the top layer. + - `use_position_of`: [string='footprint'] [footprint,reference] Which coordinate is used. - `annotate_power`: [boolean=false] Annotates all power components. This preflight modifies the schematic, use it only in revision control environments. Used to solve ERC problems when using filters that remove power reference numbers. diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 4a453276..d2948e1f 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -11,16 +11,16 @@ preflight: # Used to assign references according to footprint coordinates. # The project must be fully annotated first. annotate_pcb: - - top_main_axis: y - - top_main_ascending: true - - top_secondary_ascending: true - - top_start: 1 - - bottom_main_axis: y - - bottom_main_ascending: true - - bottom_secondary_ascending: true - - bottom_start: 101 - - use_position_of: 'footprint' - - grid: 1.0 + top_main_axis: y + top_main_ascending: true + top_secondary_ascending: true + top_start: 1 + bottom_main_axis: y + bottom_main_ascending: true + bottom_secondary_ascending: true + bottom_start: 101 + use_position_of: 'footprint' + grid: 1.0 # [boolean=false] Annotates all power components. # This preflight modifies the schematic, use it only in revision control environments. # Used to solve ERC problems when using filters that remove power reference numbers. diff --git a/kibot/pre_annotate_pcb.py b/kibot/pre_annotate_pcb.py index 5fcc5d08..8caf76e4 100644 --- a/kibot/pre_annotate_pcb.py +++ b/kibot/pre_annotate_pcb.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2022 Salvador E. Tropea -# Copyright (c) 2022 Instituto Nacional de TecnologĂ­a Industrial +# Copyright (c) 2022-2023 Salvador E. Tropea +# Copyright (c) 2022-2023 Instituto Nacional de TecnologĂ­a Industrial # License: GPL-3.0 # Project: KiBot (formerly KiPlot) from .error import PlotError @@ -131,18 +131,22 @@ class Annotate_PCB(BasePreFlight): # noqa: F821 self._sch_related = True self._pcb_related = True + @classmethod + def get_doc(cls): + return cls.__doc__, Annotate_PCBOptions + def get_example(): """ Returns a YAML value for the example config """ - return "\n - top_main_axis: y"\ - "\n - top_main_ascending: true"\ - "\n - top_secondary_ascending: true"\ - "\n - top_start: 1"\ - "\n - bottom_main_axis: y"\ - "\n - bottom_main_ascending: true"\ - "\n - bottom_secondary_ascending: true"\ - "\n - bottom_start: 101"\ - "\n - use_position_of: 'footprint'"\ - "\n - grid: 1.0" + return ("\n top_main_axis: y" + "\n top_main_ascending: true" + "\n top_secondary_ascending: true" + "\n top_start: 1" + "\n bottom_main_axis: y" + "\n bottom_main_ascending: true" + "\n bottom_secondary_ascending: true" + "\n bottom_start: 101" + "\n use_position_of: 'footprint'" + "\n grid: 1.0") def annotate_ki6(self, changes): """ Apply changes to the KiCad 6 schematic """