- update the TCL keyword list

- fix on the Gerber parser that makes searching for '%%' char optional when doing regex search for mode, units or image polarity. This allow loading Gerber files generated by the ECAD software TCl4.4
This commit is contained in:
Marius Stanciu
2019-03-29 13:02:53 +02:00
committed by Marius
parent e0417b034b
commit c5a77841f8
3 changed files with 189 additions and 312 deletions

View File

@@ -1953,12 +1953,12 @@ class Gerber (Geometry):
# The format of X and Y must be the same!
# L-omit leading zeros, T-omit trailing zeros
# A-absolute notation, I-incremental notation
self.fmt_re = re.compile(r'%FS([LT])([AI])X(\d)(\d)Y\d\d\*%$')
self.fmt_re = re.compile(r'%?FS([LT])([AI])X(\d)(\d)Y\d\d\*%?$')
self.fmt_re_alt = re.compile(r'%FS([LT])([AI])X(\d)(\d)Y\d\d\*MO(IN|MM)\*%$')
self.fmt_re_orcad = re.compile(r'(G\d+)*\**%FS([LT])([AI]).*X(\d)(\d)Y\d\d\*%$')
# Mode (IN/MM)
self.mode_re = re.compile(r'^%MO(IN|MM)\*%$')
self.mode_re = re.compile(r'^%?MO(IN|MM)\*%?$')
# Comment G04|G4
self.comm_re = re.compile(r'^G0?4(.*)$')
@@ -2013,7 +2013,7 @@ class Gerber (Geometry):
self.eof_re = re.compile(r'^M02\*')
# IP - Image polarity
self.pol_re = re.compile(r'^%IP(POS|NEG)\*%$')
self.pol_re = re.compile(r'^%?IP(POS|NEG)\*%?$')
# LP - Level polarity
self.lpol_re = re.compile(r'^%LP([DC])\*%$')
@@ -6170,7 +6170,7 @@ class CNCjob(Geometry):
# Process every instruction
for line in StringIO(self.gcode):
if '%MO' in line or '%' in line:
if '%MO' in line or '%' in line or 'MOIN' in line or 'MOMM' in line:
return "fail"
gobj = self.codes_split(line)