Просмотр исходного кода

Added support for M71/72 in Excellon parser.

jpcaram 11 лет назад
Родитель
Сommit
1b154ab057
1 измененных файлов с 13 добавлено и 1 удалено
  1. 13 1
      camlib.py

+ 13 - 1
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: