From 1b154ab05788210d8b22b6e42caf000ef75a03be Mon Sep 17 00:00:00 2001 From: jpcaram Date: Sun, 11 Jan 2015 18:28:59 -0500 Subject: [PATCH] Added support for M71/72 in Excellon parser. --- camlib.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/camlib.py b/camlib.py index c15605ec..40b4ef7a 100644 --- a/camlib.py +++ b/camlib.py @@ -1880,15 +1880,27 @@ class Excellon(Geometry): ### Cleanup lines eline = eline.strip(' \r\n') - ## Header Begin (M48) / End (M95) ## + ## Header Begin (M48) ## if self.hbegin_re.search(eline): in_header = True continue + ## Header End ## if self.hend_re.search(eline): in_header = False continue + ## Alternative units format M71/M72 + # Supposed to be just in the body (yes, the body) + # but some put it in the header (PADS for example). + # Will detect anywhere. Occurrence will change the + # object's units. + match = self.meas_re.match(eline) + if match: + self.units = {"1": "MM", "2": "IN"}[match.group(1)] + log.debug(" Units: %s" % self.units) + continue + #### Body #### if not in_header: