From 9b61e4cc3727f8c8e30a6e13978e415dc3b92452 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 12 Feb 2019 15:12:12 +0200 Subject: [PATCH] - finished work on Offset parameter in Excellon Object (Excellon Editor, camlib, FlatCAMObj updated to take this param in consideration) - fixed a bug where in Excellon editor when editing a file, a tool was automatically added. That is supposed to happen only for empty newly created Excellon Objects. --- FlatCAMEditor.py | 18 +++++++++++++++--- FlatCAMObj.py | 3 +-- README.md | 4 +++- camlib.py | 23 +++++++++++++++++++++++ make_win.py | 4 ++-- 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/FlatCAMEditor.py b/FlatCAMEditor.py index 7e4d4b49..8b937f77 100644 --- a/FlatCAMEditor.py +++ b/FlatCAMEditor.py @@ -3970,6 +3970,9 @@ class FlatCAMExcEditor(QtCore.QObject): for deleted_tool_dia in deleted_tool_dia_list: + # delete de tool offset + self.exc_obj.tool_offset.pop(float(deleted_tool_dia), None) + # delete the storage used for that tool storage_elem = FlatCAMGeoEditor.make_storage() self.storage_dict[deleted_tool_dia] = storage_elem @@ -3985,8 +3988,8 @@ class FlatCAMExcEditor(QtCore.QObject): if flag_del: for tool_to_be_deleted in flag_del: + # delete the tool self.tool2tooldia.pop(tool_to_be_deleted, None) - self.exc_obj.tool_offset.pop(tool_to_be_deleted, None) # delete also the drills from points_edit dict just in case we add the tool again, we don't want to show the # number of drills from before was deleter @@ -4027,6 +4030,11 @@ class FlatCAMExcEditor(QtCore.QObject): self.olddia_newdia[dia_changed] = current_table_dia_edited # update the dict that holds tool_no as key and tool_dia as value self.tool2tooldia[key_in_tool2tooldia] = current_table_dia_edited + + # update the tool offset + modified_offset = self.exc_obj.tool_offset.pop(dia_changed) + self.exc_obj.tool_offset[current_table_dia_edited] = modified_offset + self.replot() else: # tool diameter is already in use so we move the drills from the prior tool to the new tool @@ -4040,6 +4048,9 @@ class FlatCAMExcEditor(QtCore.QObject): self.on_tool_delete(dia=dia_changed) + # delete the tool offset + self.exc_obj.tool_offset.pop(dia_changed, None) + # we reactivate the signals after the after the tool editing self.tools_table_exc.itemChanged.connect(self.on_tool_edit) # self.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected) @@ -4226,8 +4237,9 @@ class FlatCAMExcEditor(QtCore.QObject): self.replot() - # add a first tool in the Tool Table - self.on_tool_add(tooldia=1.00) + # add a first tool in the Tool Table but only if the Excellon Object is empty + if not self.tool2tooldia: + self.on_tool_add(tooldia=1.00) def update_fcexcellon(self, exc_obj): """ diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 7a186199..86302331 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -1328,8 +1328,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): self.tool_offset[dia] = current_table_offset_edited - print(self.tool_offset) - # we reactivate the signals after the after the tool editing self.ui.tools_table.itemChanged.connect(self.on_tool_offset_edit) @@ -1763,6 +1761,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): app_obj.progress.emit(20) job_obj.z_cut = float(self.options["drillz"]) + job_obj.tool_offset = self.tool_offset job_obj.z_move = float(self.options["travelz"]) job_obj.feedrate = float(self.options["feedrate"]) job_obj.feedrate_rapid = float(self.options["feedrate_rapid"]) diff --git a/README.md b/README.md index 534ce0f1..dec61081 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ CAD program, and create G-Code for Isolation routing. - whenever a FlatCAM tool is activated, if the notebook side is hidden it will be unhidden - reactivated the Voronoi classed - added a new parameter named Offset in the Excellon tool table - work in progress +- finished work on Offset parameter in Excellon Object (Excellon Editor, camlib, FlatCAMObj updated to take this param in consideration) +- fixed a bug where in Excellon editor when editing a file, a tool was automatically added. That is supposed to happen only for empty newly created Excellon Objects. 10.02.2019 @@ -38,7 +40,7 @@ CAD program, and create G-Code for Isolation routing. 8.02.2019 -- when shortcut keys 1, 2, 3 (tab selection) are activated, if the splitter left side (the notebook) is hidden it will be mae visible +- when shortcut keys 1, 2, 3 (tab selection) are activated, if the splitter left side (the notebook) is hidden it will be made visible - changed the menu entry Toggle Grid name to Toggle Grid Snap - fixed errors in Toggle Axis - fixed error with shortcut key triggering twice the keyPressEvent when in the Project List View diff --git a/camlib.py b/camlib.py index 8d020053..f90359af 100644 --- a/camlib.py +++ b/camlib.py @@ -4399,6 +4399,8 @@ class CNCjob(Geometry): self.units = units self.z_cut = z_cut + self.tool_offset = {} + self.z_move = z_move self.feedrate = feedrate @@ -4746,6 +4748,13 @@ class CNCjob(Geometry): if self.dwell is True: gcode += self.doformat(p.dwell_code) # Dwell time + if self.units == 'MM': + current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"])) + else: + current_tooldia = float('%.3f' % float(exobj.tools[tool]["C"])) + z_offset = float(self.tool_offset[current_tooldia]) * (-1) + self.z_cut += z_offset + # Drillling! for k in node_list: locx = locations[k][0] @@ -4827,6 +4836,14 @@ class CNCjob(Geometry): if self.dwell is True: gcode += self.doformat(p.dwell_code) # Dwell time + if self.units == 'MM': + current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"])) + else: + current_tooldia = float('%.3f' % float(exobj.tools[tool]["C"])) + + z_offset = float(self.tool_offset[current_tooldia]) * (-1) + self.z_cut += z_offset + # Drillling! for k in node_list: locx = locations[k][0] @@ -4868,6 +4885,12 @@ class CNCjob(Geometry): if self.dwell is True: gcode += self.doformat(p.dwell_code) # Dwell time + if self.units == 'MM': + current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"])) + else: + current_tooldia = float('%.3f' % float(exobj.tools[tool]["C"])) + z_offset = float(self.tool_offset[current_tooldia]) * (-1) + self.z_cut += z_offset # Drillling! altPoints = [] for point in points[tool]: diff --git a/make_win.py b/make_win.py index 741e7a15..486270e4 100644 --- a/make_win.py +++ b/make_win.py @@ -79,12 +79,12 @@ else: print("INCLUDE_FILES", include_files) -#execfile('clean.py') +# execfile('clean.py') setup( name="FlatCAM", author="Juan Pablo Caram", - version="3000", + version="Beta", description="FlatCAM: 2D Computer Aided PCB Manufacturing", options=dict(build_exe=buildOptions), executables=[Executable("FlatCAM.py", icon='share/flatcam_icon48.ico', base=base)]