diff --git a/CHANGELOG.md b/CHANGELOG.md index a7dbc0a1..010b1dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,7 +87,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Can be disabled to use absolute coordinates. (#87) - Board View: flipped output. (#89) - Board View: problems with netnames using spaces. (#90) -- Schematic load: problems with fields containing double quotes. (#98) +- Schematic + - load: problems with fields containing double quotes. (#98) + - Paper orientation was discarded on v5 files. (#150) - `--list`: problems with layers and fields specific for the project. (INTI-CMNB/kibot_variants_arduprog#4) - Makefile: %VALUE not expanded in the directory targets. diff --git a/kibot/kicad/v5_sch.py b/kibot/kicad/v5_sch.py index d2554bc2..683b53e9 100644 --- a/kibot/kicad/v5_sch.py +++ b/kibot/kicad/v5_sch.py @@ -1494,12 +1494,15 @@ class Schematic(object): def _get_title_block(self, f): line = f.get_line() - m = re.match(r'\$Descr (\S+) (\d+) (\d+)', line) + m = re.match(r'\$Descr (\S+) (\d+) (\d+)( portrait)?', line) if not m: raise SchFileError('Missing $Descr', line, f) self.page_type = m.group(1) self.page_width = m.group(2) self.page_height = m.group(3) + self.paper_orientation = None + if m.group(4): + self.paper_orientation = m.group(4).strip() self.sheet = 1 self.nsheets = 1 self.title_block = OrderedDict() @@ -1748,7 +1751,10 @@ class Schematic(object): f.write('EESchema Schematic File Version {}\n'.format(self.version)) f.write('EELAYER {} {}\n'.format(self.eelayer_n, self.eelayer_m)) f.write('EELAYER END\n') - f.write('$Descr {} {} {}\n'.format(self.page_type, self.page_width, self.page_height)) + f.write('$Descr {} {} {}'.format(self.page_type, self.page_width, self.page_height)) + if self.paper_orientation: + f.write(' {}'.format(self.paper_orientation)) + f.write('\n') f.write('encoding utf-8\n') f.write('Sheet {} {}\n'.format(self.sheet, self.nsheets)) for k, v in self.title_block.items(): diff --git a/tests/board_samples/kicad_5/test_v5.sch b/tests/board_samples/kicad_5/test_v5.sch index 73156636..a387b47e 100644 --- a/tests/board_samples/kicad_5/test_v5.sch +++ b/tests/board_samples/kicad_5/test_v5.sch @@ -1,7 +1,7 @@ EESchema Schematic File Version 4 EELAYER 30 0 EELAYER END -$Descr A4 11693 8268 +$Descr A4 8268 11693 portrait encoding utf-8 Sheet 1 5 Title "Title" diff --git a/tests/reference/5_1_6/test_v5-schematic_(no_L).pdf b/tests/reference/5_1_6/test_v5-schematic_(no_L).pdf index 781a5d08..93689cfb 100644 Binary files a/tests/reference/5_1_6/test_v5-schematic_(no_L).pdf and b/tests/reference/5_1_6/test_v5-schematic_(no_L).pdf differ diff --git a/tests/reference/5_1_6/test_v5-schematic_(no_L).svg b/tests/reference/5_1_6/test_v5-schematic_(no_L).svg index 89bef9f3..ec030264 100644 --- a/tests/reference/5_1_6/test_v5-schematic_(no_L).svg +++ b/tests/reference/5_1_6/test_v5-schematic_(no_L).svg @@ -6,8 +6,8 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" - width="29.700220cm" height="21.000720cm" viewBox="0 0 116930 82680"> -SVG Picture created as test_v5.svg date 2021/12/03 15:25:12 + width="21.000720cm" height="29.700220cm" viewBox="0 0 82680 116930"> +SVG Picture created as test_v5.svg date 2022/02/17 12:18:18 Picture generated by Eeschema-SVG - + - + - + - - - - - - - - - - 1 @@ -197,25 +175,8 @@ stroke-linecap:round; stroke-linejoin:round;"> -5 - -6 - - - - - - - - - - - - - - - - - - - - - - -1 - - -2 - -3 - -4 - - - - - - -5 - - - - - -6 - + + + + + + + + + + A @@ -598,8 +452,16 @@ stroke-linecap:round; stroke-linejoin:round;"> -E + + -F + + - - + + + + + + + + + + + + + + + + + + + +A - - -B - -C - -D - -E + + + + + + +F + + + + + + +Date: 2020-08-12 - - - - - - - - - - - - - - - - - - - - -KiCad E.D.A. eeschema 5.1.9+dfsg1-1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Rev: r1B - - - - - - - - - - - -Size: A4 - - - - - - - - - - - -Id: 1/5 - - - - - - - - - - -Title: Title - - - - - - - - - - - - - - - - - - -File: test_v5.sch - - - - - - - - - - - - - - - - - - - - - - - -Sheet: / - - - - - - - - - - -Company - - - - - - - - - - - - - -Comment 1 - - - - - - - - - - - - - - - -Comment 2 - - - - - - - - - - - - - - -Comment 3 - - - - - - - - - - - - - - -@Comment4@ - - - - - - - - - - - - - - - - - - - - -