From b95c2baaf201b6a02ad680e535bd557321b3087b Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 24 Jan 2022 14:23:45 +0100 Subject: Add new test files --- gerbonara/gerber/rs274x.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gerbonara/gerber/rs274x.py') diff --git a/gerbonara/gerber/rs274x.py b/gerbonara/gerber/rs274x.py index 859a29e..fe85c09 100644 --- a/gerbonara/gerber/rs274x.py +++ b/gerbonara/gerber/rs274x.py @@ -295,6 +295,7 @@ class GraphicsState: self.file_settings = file_settings self.aperture_map = aperture_map or {} self.warn = warn + self.unit_warning = False def __setattr__(self, name, value): # input validation @@ -362,6 +363,9 @@ class GraphicsState: return rx, ry def flash(self, x, y, attrs=None): + if self.file_settings.unit is None and not self.unit_warning: + self.warn('Gerber file does not contain a unit definition.') + self.unit_warning = True attrs = attrs or {} self.update_point(x, y) return go.Flash(*self.map_coord(*self.point), self.aperture, @@ -375,6 +379,10 @@ class GraphicsState: self.point = (0, 0) old_point = self.map_coord(*self.update_point(x, y)) + if self.file_settings.unit is None and not self.unit_warning: + self.warn('Gerber file does not contain a unit definition.') + self.unit_warning = True + if aperture: if not self.aperture: raise SyntaxError('Interpolation attempted without selecting aperture first') -- cgit