Skip to content

Commit 655df0e

Browse files
committed
[EEschema][Added] --pages to the export option
1 parent 91594e5 commit 655df0e

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- More robust Altium conversion
1111
- KiCad 8: Support for nested modals (Report + Missing font)
1212
- KiCad 9: Dismiss layer mapping
13+
- Schematic print: --pages option
1314

1415

1516
## [2.3.5] - 2024-04-03

src/eeschema_do

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3-
# Copyright (c) 2020-2024 Salvador E. Tropea
4-
# Copyright (c) 2020-2024 Instituto Nacional de Tecnologïa Industrial
3+
# Copyright (c) 2020-2026 Salvador E. Tropea
4+
# Copyright (c) 2020-2026 Instituto Nacional de Tecnologïa Industrial
55
# Copyright (c) 2019 Jesse Vincent (@obra)
66
# Copyright (c) 2018-2019 Seppe Stas (@seppestas) (Productize SPRL)
77
# Based on ideas by: Scott Bezek (@scottbez1)
@@ -240,11 +240,21 @@ def eeschema_plot_schematic_cli(cfg):
240240
cmd.append('--exclude-drawing-sheet')
241241
if not cfg.background_color and cfg.export_format != 'dxf' and cfg.export_format != 'hpgl':
242242
cmd.append('--no-background-color')
243-
if not cfg.all_pages:
244-
if cfg.ki8:
243+
# pages/all_pages
244+
if cfg.ki8:
245+
if cfg.pages:
246+
cmd.extend(['--pages', cfg.pages])
247+
elif not cfg.all_pages:
245248
cmd.extend(['--pages', '1'])
246-
else:
249+
# else: nothing means all pages
250+
else:
251+
if cfg.pages:
252+
logger.error('Pages is available only for KiCad 8+ and the CLI')
253+
exit(WRONG_ARGUMENTS)
254+
elif not cfg.all_pages:
247255
cmd.append('--plot-one')
256+
# else: nothing means all pages
257+
# default_font
248258
if cfg.ki9 and cfg.default_font:
249259
cmd.extend(['--default-font', cfg.default_font])
250260
cmd.append(cfg.input_file)
@@ -919,7 +929,11 @@ if __name__ == '__main__':
919929
export_parser = subparsers.add_parser('export', help='Export a schematic')
920930
export_parser.add_argument('--file_format', '-f', help='Export file format',
921931
choices=['svg', 'pdf', 'ps', 'dxf', 'hpgl'], default='pdf')
922-
export_parser.add_argument('--all_pages', '-a', help='Plot all schematic pages in one file', action='store_true')
932+
933+
pages_group = export_parser.add_mutually_exclusive_group()
934+
pages_group.add_argument('--all_pages', '-a', help='Plot all schematic pages in one file', action='store_true')
935+
pages_group.add_argument('--pages', type=str, help='Comma separated list of pages (KiCad 8+/CLI)')
936+
923937
export_parser.add_argument('--monochrome', '-m', help='Black and white output', action='store_true')
924938
export_parser.add_argument('--no_frame', '-F', help='No frame and title block', action='store_true')
925939
export_parser.add_argument('--output_name', '-o', nargs=1, help='Name of the output file')
@@ -957,6 +971,7 @@ if __name__ == '__main__':
957971
cfg.verbose = args.verbose
958972
cfg.video_name = args.command+'_eeschema_screencast.ogv'
959973
cfg.all_pages = getattr(args, 'all_pages', False)
974+
cfg.pages = getattr(args, 'pages')
960975
cfg.monochrome = getattr(args, 'monochrome', False)
961976
cfg.no_frame = getattr(args, 'no_frame', False)
962977
cfg.warnings_as_errors = getattr(args, 'warnings_as_errors', False)

0 commit comments

Comments
 (0)