Jelajahi Sumber

- moved default_data data update from Excellon parser to the Excellon object constructor

Marius Stanciu 6 tahun lalu
induk
melakukan
c417030896
3 mengubah file dengan 12 tambahan dan 11 penghapusan
  1. 11 0
      FlatCAMObj.py
  2. 1 0
      README.md
  3. 0 11
      flatcamParsers/ParseExcellon.py

+ 11 - 0
FlatCAMObj.py

@@ -2269,6 +2269,17 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
         # dict to hold the tool number as key and tool offset as value
         self.tool_offset = dict()
 
+        # default set of data to be added to each tool in self.tools as self.tools[tool]['data'] = self.default_data
+        self.default_data = dict()
+
+        # fill in self.default_data values from self.options
+        for opt_key, opt_val in self.app.options.items():
+            if opt_key.find('excellon_') == 0:
+                self.default_data[opt_key] = deepcopy(opt_val)
+        for opt_key, opt_val in self.app.options.items():
+            if opt_key.find('geometry_') == 0:
+                self.default_data[opt_key] = deepcopy(opt_val)
+
         # variable to store the total amount of drills per job
         self.tot_drill_cnt = 0
         self.tool_row = 0

+ 1 - 0
README.md

@@ -19,6 +19,7 @@ CAD program, and create G-Code for Isolation routing.
 - put bases for future changes to Excellon Object UI such that each tool will hold it's own parameters
 - in ParseExcellon.Excellon the self.tools dict has now a key 'data' which holds a dict with all the default values for Excellon and Geometry
 - Excellon and Geometry objects, when started with multiple tools selected, the parameters tool name reflect this situation
+- moved default_data data update from Excellon parser to the Excellon object constructor
 
 15.01.2020
 

+ 0 - 11
flatcamParsers/ParseExcellon.py

@@ -121,9 +121,6 @@ class Excellon(Geometry):
         self.zeros_found = deepcopy(self.zeros)
         self.units_found = deepcopy(self.units)
 
-        # default set of data to be added to each tool in self.tools as self.tools[tool]['data'] = self.default_data
-        self.default_data = dict()
-
         # this will serve as a default if the Excellon file has no info regarding of tool diameters (this info may be
         # in another file like for PCB WIzard ECAD software
         self.toolless_diam = 1.0
@@ -264,14 +261,6 @@ class Excellon(Geometry):
         except Exception:
             return "fail"
 
-        # fill in self.default_data values from self.options
-        for opt_key, opt_val in self.app.options.items():
-            if opt_key.find('excellon_') == 0:
-                self.default_data[opt_key] = deepcopy(opt_val)
-        for opt_key, opt_val in self.app.options.items():
-            if opt_key.find('geometry_') == 0:
-                self.default_data[opt_key] = deepcopy(opt_val)
-
     def parse_lines(self, elines):
         """
         Main Excellon parser.