Support for optional '+' on Gerber numbers. Solvers #142.

This commit is contained in:
jpcaram 2015-06-20 12:03:48 -04:00 committed by Cedric Dussud
parent 432e19273b
commit cd39a55696

View File

@ -1223,7 +1223,7 @@ class Gerber (Geometry):
# G01... - Linear interpolation plus flashes with coordinates # G01... - Linear interpolation plus flashes with coordinates
# Operation code (D0x) missing is deprecated... oh well I will support it. # 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) # Operation code alone, usually just D03 (Flash)
self.opcode_re = re.compile(r'^D0?([123])\*$') 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. # 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 start with G02 or G03, optional end with D01 or D02 with
# optional coordinates but at least one in any order. # optional coordinates but at least one in any order.
self.circ_re = re.compile(r'^(?:G0?([23]))?(?=.*X(-?\d+))?(?=.*Y(-?\d+))' + self.circ_re = re.compile(r'^(?:G0?([23]))?(?=.*X([\+-]?\d+))?(?=.*Y([\+-]?\d+))' +
'?(?=.*I(-?\d+))?(?=.*J(-?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$') '?(?=.*I([\+-]?\d+))?(?=.*J([\+-]?\d+))?[XYIJ][^D]*(?:D0([12]))?\*$')
# G01/2/3 Occurring without coordinates # G01/2/3 Occurring without coordinates
self.interp_re = re.compile(r'^(?:G0?([123]))\*') self.interp_re = re.compile(r'^(?:G0?([123]))\*')