diff --git a/CHANGELOG.md b/CHANGELOG.md index aa65be28..0e80c500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Currently just parsed, not rejected. - PCB/SCH parity test: - Check for value and fields/properties. +- SCH print: + - Support for title change ### Fixed - Makefile: don't skip all preflights on each run, just the ones we generate diff --git a/README.md b/README.md index bd9b824b..cc9b830a 100644 --- a/README.md +++ b/README.md @@ -2277,6 +2277,8 @@ Notes: - `output`: [string='%f-%i%I%v.%x'] Filename for the output DXF (%i=schematic, %x=dxf). Affected by global options. - `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. + - `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated. - `variant`: [string=''] Board variant to apply. Not fitted components are crossed. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. @@ -2596,6 +2598,8 @@ Notes: - `pen_size`: [number=0.4826] Pen size (diameter) [mm]. - `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. + - `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated. - `variant`: [string=''] Board variant to apply. Not fitted components are crossed. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. @@ -3894,6 +3898,8 @@ Notes: - `output`: [string='%f-%i%I%v.%x'] Filename for the output PDF (%i=schematic, %x=pdf). Affected by global options. - `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. + - `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated. - `variant`: [string=''] Board variant to apply. Not fitted components are crossed. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. @@ -4133,6 +4139,8 @@ Notes: - `output`: [string='%f-%i%I%v.%x'] Filename for the output postscript (%i=schematic, %x=ps). Affected by global options. - `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. + - `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated. - `variant`: [string=''] Board variant to apply. Not fitted components are crossed. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. @@ -4681,6 +4689,8 @@ Notes: - `output`: [string='%f-%i%I%v.%x'] Filename for the output SVG (%i=schematic, %x=svg). Affected by global options. - `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. + - `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated. - `variant`: [string=''] Board variant to apply. Not fitted components are crossed. - `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used. @@ -5401,7 +5411,7 @@ KiBot: KiCad automation tool for documents generation Usage: kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE] [-D] - [-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... + [-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [-E DEF] ... [-w LIST] [--banner N] [TARGET...] kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N] [-E DEF] ... --list @@ -5436,6 +5446,8 @@ Options: -g DEF, --global-redef DEF Overwrite a global value (VAR=VAL) -i, --invert-sel Generate the outputs not listed as targets -l, --list List available outputs (in the config file) + -L, --log LOGFILE Log to LOGFILE using maximum debug level. + Is independent of what is logged to stderr -m MKFILE, --makefile MKFILE Generate a Makefile (no targets created) -n, --no-priority Don't sort targets by priority -p, --copy-options Copy plot options from the PCB file diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 933d643b..df351b4e 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -869,6 +869,9 @@ 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' + # [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + # If it starts with `+` the text is concatenated + title: '' # [string=''] Board variant to apply. # Not fitted components are crossed variant: '' @@ -1172,6 +1175,9 @@ 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' + # [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + # If it starts with `+` the text is concatenated + title: '' # [string=''] Board variant to apply. # Not fitted components are crossed variant: '' @@ -2602,6 +2608,9 @@ 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' + # [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + # If it starts with `+` the text is concatenated + title: '' # [string=''] Board variant to apply. # Not fitted components are crossed variant: '' @@ -2813,6 +2822,9 @@ 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' + # [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + # If it starts with `+` the text is concatenated + title: '' # [string=''] Board variant to apply. # Not fitted components are crossed variant: '' @@ -3333,6 +3345,9 @@ 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' + # [string=''] Text used to replace the sheet title. %VALUE expansions are allowed. + # If it starts with `+` the text is concatenated + title: '' # [string=''] Board variant to apply. # Not fitted components are crossed variant: '' diff --git a/kibot/out_any_sch_print.py b/kibot/out_any_sch_print.py index 84d52f6c..2d869af9 100644 --- a/kibot/out_any_sch_print.py +++ b/kibot/out_any_sch_print.py @@ -42,6 +42,9 @@ class Any_SCH_PrintOptions(VariantOptions): """ Color theme used, this must exist in the KiCad config (KiCad 6) """ self.background_color = False """ Use the background color from the `color_theme` (KiCad 6) """ + self.title = '' + """ Text used to replace the sheet title. %VALUE expansions are allowed. + If it starts with `+` the text is concatenated """ super().__init__() self.add_to_doc('variant', "Not fitted components are crossed") self._expand_id = 'schematic' @@ -54,7 +57,9 @@ class Any_SCH_PrintOptions(VariantOptions): def run(self, name): super().run(name) command = self.ensure_tool('KiAuto') - if self._comps: + if self.title: + self.set_title(self.title, sch=True) + if self._comps or self.title: # Save it to a temporal dir sch_dir = mkdtemp(prefix='tmp-kibot-'+self._expand_ext+'_sch_print-') copy_project(sch_dir) @@ -81,3 +86,5 @@ class Any_SCH_PrintOptions(VariantOptions): cmd.extend(['--hpgl_pen_size', str(self.pen_size)]) cmd.extend([sch_file, os.path.dirname(name)]) self.exec_with_retry(self.add_extra_options(cmd), self._exit_error) + if self.title: + self.restore_title(sch=True)