Fixed schematic: Paper orientation was discarded on v5 files.

Fixes #150
This commit is contained in:
Salvador E. Tropea 2022-02-17 12:40:29 -03:00
parent 174bd44a09
commit ebc6458948
5 changed files with 1892 additions and 1934 deletions

View File

@ -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.

View File

@ -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():

View File

@ -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"

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB