summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/rs274x.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-01-22 22:00:04 +0100
committerjaseg <git@jaseg.de>2022-01-22 22:00:04 +0100
commit07d279f89faefde4793ae2de4d3a629dc87da63e (patch)
tree1f6d6688dfa17c6a9b5cbafc1dd5abd48eba891a /gerbonara/gerber/rs274x.py
parent3b4b72bc59411c5e4335376479208b38307bd850 (diff)
downloadgerbonara-07d279f89faefde4793ae2de4d3a629dc87da63e.tar.gz
gerbonara-07d279f89faefde4793ae2de4d3a629dc87da63e.tar.bz2
gerbonara-07d279f89faefde4793ae2de4d3a629dc87da63e.zip
Fix last test failures
Diffstat (limited to 'gerbonara/gerber/rs274x.py')
-rw-r--r--gerbonara/gerber/rs274x.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/gerbonara/gerber/rs274x.py b/gerbonara/gerber/rs274x.py
index 401047f..50de8ca 100644
--- a/gerbonara/gerber/rs274x.py
+++ b/gerbonara/gerber/rs274x.py
@@ -579,7 +579,8 @@ class GerberParser:
elif match['interpolation'] == 'G75':
self.multi_quadrant_mode = False
- if match['interpolation'] in ('G74', 'G75') and (match['x'] or match['y'] or match['i'] or match['j']):
+ has_coord = (match['x'] or match['y'] or match['i'] or match['j'])
+ if match['interpolation'] in ('G74', 'G75') and has_coord:
raise SyntaxError('G74/G75 combined with coord')
x = self.file_settings.parse_gerber_value(match['x'])
@@ -587,12 +588,12 @@ class GerberParser:
i = self.file_settings.parse_gerber_value(match['i'])
j = self.file_settings.parse_gerber_value(match['j'])
- if not (op := match['operation']):
+ if not (op := match['operation']) and has_coord:
if self.last_operation == 'D01':
warnings.warn('Coordinate statement without explicit operation code. This is forbidden by spec.', SyntaxWarning)
op = 'D01'
- elif match['x'] or match['y'] or match['i'] or match['j']:
+ else:
raise SyntaxError('Ambiguous coordinate statement. Coordinate statement does not have an operation '\
'mode and the last operation statement was not D01.')