From cb31b15815ffea38310237be46637755a6ee6928 Mon Sep 17 00:00:00 2001 From: jpcaram Date: Sat, 20 Jun 2015 12:03:48 -0400 Subject: [PATCH] Support for optional '+' on Gerber numbers. Solvers #142. --- camlib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/camlib.py b/camlib.py index cc0a20ef..8c505c40 100644 --- a/camlib.py +++ b/camlib.py @@ -1223,7 +1223,7 @@ class Gerber (Geometry): # G01... - Linear interpolation plus flashes with coordinates # Operation code (D0x) missing is deprecated... oh well I will support it. - self.lin_re = re.compile(r'^(?:G0?(1))?(?=.*X(-?\d+))?(?=.*Y(-?\d+))?[XY][^DIJ]*(?:D0?([123]))?\*$') + self.lin_re = re.compile(r'^(?:G0?(1))?(?=.*X([\+-]?\d+))?(?=.*Y([\+-]?\d+))?[XY][^DIJ]*(?:D0?([123]))?\*$') # Operation code alone, usually just D03 (Flash) self.opcode_re = re.compile(r'^D0?([123])\*$') @@ -1233,8 +1233,8 @@ class Gerber (Geometry): # Operation code (D0x) missing is deprecated... oh well I will support it. # Optional start with G02 or G03, optional end with D01 or D02 with # optional coordinates but at least one in any order. - self.circ_re = re.compile(r'^(?:G0?([23]))?(?=.*X(-?\d+))?(?=.*Y(-?\d+))' + - '?(?=.*I(-?\d+))?(?=.*J(-?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$') + self.circ_re = re.compile(r'^(?:G0?([23]))?(?=.*X([\+-]?\d+))?(?=.*Y([\+-]?\d+))' + + '?(?=.*I([\+-]?\d+))?(?=.*J([\+-]?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$') # G01/2/3 Occurring without coordinates self.interp_re = re.compile(r'^(?:G0?([123]))\*')