Skip to content

Commit f5b2b5f

Browse files
committed
[*SCH Print][Added] Title propagation also KiCad workaround
- `title_propagate`: The title is not only set for page 1 but also for all pages. - Global `schematic_sheet_name_workaround` to workaround SHEETNAME on page 1 See #933
1 parent 4fa5632 commit f5b2b5f

16 files changed

Lines changed: 161 additions & 29 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
for KiCad 6.
1616
- Schematic:
1717
- Support for SHEETNAME, SHEETFILE and SHEETPATH in the title block
18+
- Globals:
19+
- `schematic_sheet_name_workaround` to workaround SHEETNAME on page 1
20+
(See #933)
1821
- Variants:
1922
- pre_transform filter to KiCad variants
2023
- E/DRC:
@@ -35,6 +38,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3538
- `collect_images`: To just avoid collecting images, enabled by
3639
default when generating a CSV. Avoids unintended infinite loops.
3740
(See #931)
41+
- *SCH Print
42+
- `title_propagate`: The title is not only set for page 1 but also for
43+
all pages.
3844

3945
## Fixed
4046
- Warnings:

docs/samples/generic_plot.kibot.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,8 @@ outputs:
13651365
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
13661366
# If it starts with `+` the text is concatenated
13671367
title: ''
1368+
# [boolean=false] When enabled we also set the title for all the sub-sheets
1369+
title_propagate: false
13681370
# [string=''] Board variant to apply.
13691371
# Not fitted components are crossed
13701372
variant: ''
@@ -1900,6 +1902,8 @@ outputs:
19001902
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
19011903
# If it starts with `+` the text is concatenated
19021904
title: ''
1905+
# [boolean=false] When enabled we also set the title for all the sub-sheets
1906+
title_propagate: false
19031907
# [string=''] Board variant to apply.
19041908
# Not fitted components are crossed
19051909
variant: ''
@@ -4121,6 +4125,8 @@ outputs:
41214125
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
41224126
# If it starts with `+` the text is concatenated
41234127
title: ''
4128+
# [boolean=false] When enabled we also set the title for all the sub-sheets
4129+
title_propagate: false
41244130
# [string=''] Board variant to apply.
41254131
# Not fitted components are crossed
41264132
variant: ''
@@ -4401,6 +4407,8 @@ outputs:
44014407
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
44024408
# If it starts with `+` the text is concatenated
44034409
title: ''
4410+
# [boolean=false] When enabled we also set the title for all the sub-sheets
4411+
title_propagate: false
44044412
# [string=''] Board variant to apply.
44054413
# Not fitted components are crossed
44064414
variant: ''
@@ -4626,6 +4634,14 @@ outputs:
46264634
# The 7.4 is the standard for lead-free (i.e. SAC305) for 63 Sn/37 Pb 8.4 is standard.
46274635
# Used to compute solder paste usage
46284636
alloy_specific_gravity: 7.4
4637+
# [string='auto'] [auto,yes,no] When enabled we look for outputs that can generate useful images.
4638+
# They are `pdf_pcb_print`, `pcb_print`, `svg_pcb_print`, `pdf_sch_print`, `svg_sch_print`
4639+
# and may be others. They are executed in order to get their outputs and make them available
4640+
# using the `schematic_pdfs`, `schematic_svgs`, `layer_pdfs` and `layer_svgs` images.
4641+
# The problem is when a `pcb_print` output needs a table generated by a `report` output.
4642+
# This can lead to a 'chicken and the egg' problem.
4643+
# The `auto` option only enables the search when the output isn't a `csv`.
4644+
collect_images: 'auto'
46294645
# [string='markdown'] Original format for the report conversion. Current templates are `markdown`. See `do_convert`
46304646
convert_from: 'markdown'
46314647
# [string='pdf'] Target format for the report conversion. See `do_convert`
@@ -5136,6 +5152,8 @@ outputs:
51365152
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
51375153
# If it starts with `+` the text is concatenated
51385154
title: ''
5155+
# [boolean=false] When enabled we also set the title for all the sub-sheets
5156+
title_propagate: false
51395157
# [string=''] Board variant to apply.
51405158
# Not fitted components are crossed
51415159
variant: ''

docs/source/Changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Added
3131

3232
- Support for SHEETNAME, SHEETFILE and SHEETPATH in the title block
3333

34+
- Globals:
35+
36+
- ``schematic_sheet_name_workaround`` to workaround SHEETNAME on
37+
page 1 (See #933)
38+
3439
- Variants:
3540

3641
- pre_transform filter to KiCad variants
@@ -63,6 +68,11 @@ Added
6368
default when generating a CSV. Avoids unintended infinite loops.
6469
(See #931)
6570

71+
- \*SCH Print
72+
73+
- ``title_propagate``: The title is not only set for page 1 but also
74+
for all pages.
75+
6676
Fixed
6777
-----
6878

docs/source/configuration/outputs/DXF_SCH_PrintOptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ DXF_SCH_PrintOptions parameters
3434
file is available.
3535
- ``title`` :index:`: <pair: output - dxf_sch_print - options; title>` [:ref:`string <string>`] (default: ``''``) Text used to replace the sheet title. %VALUE expansions are allowed.
3636
If it starts with `+` the text is concatenated.
37+
- ``title_propagate`` :index:`: <pair: output - dxf_sch_print - options; title_propagate>` [:ref:`boolean <boolean>`] (default: ``false``) When enabled we also set the title for all the sub-sheets.
3738
- ``variant`` :index:`: <pair: output - dxf_sch_print - options; variant>` [:ref:`string <string>`] (default: ``''``) Board variant to apply.
3839
Not fitted components are crossed.
3940

docs/source/configuration/outputs/HPGL_SCH_PrintOptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ HPGL_SCH_PrintOptions parameters
3636
file is available.
3737
- ``title`` :index:`: <pair: output - hpgl_sch_print - options; title>` [:ref:`string <string>`] (default: ``''``) Text used to replace the sheet title. %VALUE expansions are allowed.
3838
If it starts with `+` the text is concatenated.
39+
- ``title_propagate`` :index:`: <pair: output - hpgl_sch_print - options; title_propagate>` [:ref:`boolean <boolean>`] (default: ``false``) When enabled we also set the title for all the sub-sheets.
3940
- ``variant`` :index:`: <pair: output - hpgl_sch_print - options; variant>` [:ref:`string <string>`] (default: ``''``) Board variant to apply.
4041
Not fitted components are crossed.
4142

docs/source/configuration/outputs/PDF_SCH_PrintOptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PDF_SCH_PrintOptions parameters
3434
file is available.
3535
- ``title`` :index:`: <pair: output - pdf_sch_print - options; title>` [:ref:`string <string>`] (default: ``''``) Text used to replace the sheet title. %VALUE expansions are allowed.
3636
If it starts with `+` the text is concatenated.
37+
- ``title_propagate`` :index:`: <pair: output - pdf_sch_print - options; title_propagate>` [:ref:`boolean <boolean>`] (default: ``false``) When enabled we also set the title for all the sub-sheets.
3738
- ``variant`` :index:`: <pair: output - pdf_sch_print - options; variant>` [:ref:`string <string>`] (default: ``''``) Board variant to apply.
3839
Not fitted components are crossed.
3940

docs/source/configuration/outputs/PS_SCH_PrintOptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PS_SCH_PrintOptions parameters
3434
file is available.
3535
- ``title`` :index:`: <pair: output - ps_sch_print - options; title>` [:ref:`string <string>`] (default: ``''``) Text used to replace the sheet title. %VALUE expansions are allowed.
3636
If it starts with `+` the text is concatenated.
37+
- ``title_propagate`` :index:`: <pair: output - ps_sch_print - options; title_propagate>` [:ref:`boolean <boolean>`] (default: ``false``) When enabled we also set the title for all the sub-sheets.
3738
- ``variant`` :index:`: <pair: output - ps_sch_print - options; variant>` [:ref:`string <string>`] (default: ``''``) Board variant to apply.
3839
Not fitted components are crossed.
3940

docs/source/configuration/outputs/SVG_SCH_PrintOptions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SVG_SCH_PrintOptions parameters
3434
file is available.
3535
- ``title`` :index:`: <pair: output - svg_sch_print - options; title>` [:ref:`string <string>`] (default: ``''``) Text used to replace the sheet title. %VALUE expansions are allowed.
3636
If it starts with `+` the text is concatenated.
37+
- ``title_propagate`` :index:`: <pair: output - svg_sch_print - options; title_propagate>` [:ref:`boolean <boolean>`] (default: ``false``) When enabled we also set the title for all the sub-sheets.
3738
- ``variant`` :index:`: <pair: output - svg_sch_print - options; variant>` [:ref:`string <string>`] (default: ``''``) Board variant to apply.
3839
Not fitted components are crossed.
3940

docs/source/configuration/sup_globals.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@
210210
The width of the text box will be the width of the image. |br|
211211
The text box must contain *kibot_image_X* where X is the output name. |br|
212212
This option configures the prefix used. If this option is empty no images will be pasted.
213+
- ``schematic_sheet_name_workaround`` :index:`: <pair: global options; schematic_sheet_name_workaround>` [:ref:`boolean <boolean>`] (default: ``false``) When printing a schematic the SHEETNAME variable is wrongly expanded for page 1.
214+
This error is present in KiCad 9 and at least 10.0.3. |br|
215+
This workaround makes KiBot expand it for page 1. You must use the `title` option to set
216+
the desired title, i.e. `My Project - ${SHEETNAME}`.
213217
- ``set_text_variables_before_output`` :index:`: <pair: global options; set_text_variables_before_output>` [:ref:`boolean <boolean>`] (default: ``false``) Run the `set_text_variables` preflight before running each output that involves variants.
214218
This can be used when a text variable uses the variant and you want to create more than
215219
one variant in the same run. Note that this could be slow because it forces a board

kibot/globals.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ def __init__(self):
463463
self.code_page_fallback = 'latin1'
464464
""" Code page to use when UTF-8 decode fails. Leave empty to just use ASCII and spaces for codes
465465
outside ASCII """
466+
self.schematic_sheet_name_workaround = False
467+
""" When printing a schematic the SHEETNAME variable is wrongly expanded for page 1.
468+
This error is present in KiCad 9 and at least 10.0.3.
469+
This workaround makes KiBot expand it for page 1. You must use the `title` option to set
470+
the desired title, i.e. `My Project - ${SHEETNAME}` """
466471
self.set_doc('filters', " [list(dict)=[]] KiBot and KiCost warnings to be ignored."
467472
" Add 1000 to KiCost warnings (WCnnn) ")
468473
self._filter_what = 'KiBot warnings'

0 commit comments

Comments
 (0)