Переглянути джерело

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

jpcaram 10 роки тому
батько
коміт
cb31b15815
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      camlib.py

+ 3 - 3
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]))\*')