- modified the bogus diameters series for Excellon objects that do not have tool diameter info

- made Excellon Editor aware of the fact that the Excellon object that is edited has fake (bogus) tool diameters and therefore it will not sort the tools based on diameter but based on tool number
- fixed bug on Excellon Editor: when diameter is edited in Tools Table and the target diameter is already in the tool table, the drills from current tool are moved to the new tool (with new dia) - before it crashed
This commit is contained in:
Marius Stanciu 2019-04-04 20:15:51 +03:00
parent b595991b1d
commit f43bed8c66
3 changed files with 35 additions and 10 deletions

View File

@ -13,6 +13,9 @@ CAD program, and create G-Code for Isolation routing.
- added support for Gerber format specification D (no zero suppression) - PCBWizard Gerber files support
- added support for Excellon file with no info about tool diameters - PCB Wizard Excellon file support
- modified the bogus diameters series for Excellon objects that do not have tool diameter info
- made Excellon Editor aware of the fact that the Excellon object that is edited has fake (bogus) tool diameters and therefore it will not sort the tools based on diameter but based on tool number
- fixed bug on Excellon Editor: when diameter is edited in Tools Table and the target diameter is already in the tool table, the drills from current tool are moved to the new tool (with new dia) - before it crashed
3.04.2019

View File

@ -3868,13 +3868,11 @@ class Excellon(Geometry):
# the bellow construction is so each tool will have a slightly different diameter
# starting with a default value, to allow Excellon editing after that
self.diameterless = True
if self.excellon_units == 'MM':
self.toolless_diam += (int(current_tool) - 1) / 10
diam = self.toolless_diam + (int(current_tool) - 1) / 100
else:
self.toolless_diam += (int(current_tool) - 1) / 10
# convert to inch
self.toolless_diam /= 25.4
diam = self.toolless_diam
diam = (self.toolless_diam + (int(current_tool) - 1) / 100) / 25.4
spec = {
"C": diam,

View File

@ -1170,9 +1170,20 @@ class FlatCAMExcEditor(QtCore.QObject):
self.sorted_diameters = sorted(sort_temp)
# populate self.intial_table_rows dict with the tool number as keys and tool diameters as values
for i in range(len(self.sorted_diameters)):
tt_dia = self.sorted_diameters[i]
self.tool2tooldia[i + 1] = tt_dia
if self.exc_obj.diameterless is False:
for i in range(len(self.sorted_diameters)):
tt_dia = self.sorted_diameters[i]
self.tool2tooldia[i + 1] = tt_dia
else:
# the Excellon object has diameters that are bogus information, added by the application because the
# Excellon file has no tool diameter information. In this case do not order the diameter in the table
# but use the real order found in the exc_obj.tools
for k, v in self.exc_obj.tools.items():
if self.units == 'IN':
tool_dia = float('%.3f' % v['C'])
else:
tool_dia = float('%.2f' % v['C'])
self.tool2tooldia[int(k)] = tool_dia
def build_ui(self):
@ -1521,13 +1532,26 @@ class FlatCAMExcEditor(QtCore.QObject):
else:
# tool diameter is already in use so we move the drills from the prior tool to the new tool
factor = current_table_dia_edited / dia_changed
geometry = []
for shape in self.storage_dict[dia_changed].get_objects():
geometry.append(DrawToolShape(
MultiLineString([affinity.scale(subgeo, xfact=factor, yfact=factor) for subgeo in shape.geo])))
self.points_edit[current_table_dia_edited].append((0, 0))
self.add_exc_shape(geometry, self.storage_dict[current_table_dia_edited])
# add bogus drill points (for total count of drills)
for k, v in self.olddia_newdia.items():
if v == current_table_dia_edited:
self.points_edit[k].append((0, 0))
break
# search for the oldia that correspond to the newdia and add the drills in it's storage
# everything will be sort out later, when the edited excellon is updated
for k, v in self.olddia_newdia.items():
if v == current_table_dia_edited:
self.add_exc_shape(geometry, self.storage_dict[k])
break
# delete the old tool from which we moved the drills
self.on_tool_delete(dia=dia_changed)
# delete the tool offset