Sfoglia il codice sorgente

- fixed a bug in Tool PunchGerber when using an Excellon to punch holes in the Gerber apertures

Marius Stanciu 5 anni fa
parent
commit
baa67b1278
2 ha cambiato i file con 19 aggiunte e 15 eliminazioni
  1. 1 0
      CHANGELOG.md
  2. 18 15
      appTools/ToolPunchGerber.py

+ 1 - 0
CHANGELOG.md

@@ -22,6 +22,7 @@ CHANGELOG for FlatCAM beta
 - added some new strings for translation and updated the translation strings
 - in ToolsDB2UI class made the vertical layouts have a preferred minimum dimension as opposed to the previous fixed one
 - in Geometry Object made sure that the Tools Table second column is set to Resize to contents
+- fixed a bug in Tool PunchGerber when using an Excellon to punch holes in the Gerber apertures
 
 21.10.2020
 

+ 18 - 15
appTools/ToolPunchGerber.py

@@ -233,21 +233,24 @@ class ToolPunchGerber(AppTool):
                 for elem in val['geometry']:
                     # make it work only for Gerber Flashes who are Points in 'follow'
                     if 'solid' in elem and isinstance(elem['follow'], Point):
-                        for drill in exc_obj.drills:
-                            clear_apid_size = exc_obj.tools[drill['tool']]['tooldia']
-
-                            # since there may be drills that do not drill into a pad we test only for drills in a pad
-                            if drill['point'].within(elem['solid']):
-                                geo_elem = {}
-                                geo_elem['clear'] = drill['point']
-
-                                if clear_apid_size not in holes_apertures:
-                                    holes_apertures[clear_apid_size] = {}
-                                    holes_apertures[clear_apid_size]['type'] = 'C'
-                                    holes_apertures[clear_apid_size]['size'] = clear_apid_size
-                                    holes_apertures[clear_apid_size]['geometry'] = []
-
-                                holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
+                        for tool in exc_obj.tools:
+                            clear_apid_size = exc_obj.tools[tool]['tooldia']
+
+                            if 'drills' in exc_obj.tools[tool]['drills']:
+                                for drill_pt in exc_obj.tools[tool]['drills']:
+                                    # since there may be drills that do not drill into a pad we test only for
+                                    # drills in a pad
+                                    if drill_pt.within(elem['solid']):
+                                        geo_elem = {}
+                                        geo_elem['clear'] = drill_pt
+
+                                        if clear_apid_size not in holes_apertures:
+                                            holes_apertures[clear_apid_size] = {}
+                                            holes_apertures[clear_apid_size]['type'] = 'C'
+                                            holes_apertures[clear_apid_size]['size'] = clear_apid_size
+                                            holes_apertures[clear_apid_size]['geometry'] = []
+
+                                        holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
 
             # add the clear geometry to new apertures; it's easier than to test if there are apertures with the same
             # size and add there the clear geometry