From 4089438392727c61366913ce7e37df859dfb18c6 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 22 Jan 2022 23:28:21 +0200 Subject: [PATCH] - in Milling Plugin there was issue that did not showed the Z focus parameter for the `GRBL_laser_Z` preprocessor - updated the `GRBL_laser_Z` preprocessor to show more complete parameter information's in the header --- CHANGELOG.md | 2 ++ appPlugins/ToolMilling.py | 14 +++++--------- app_Main.py | 2 +- camlib.py | 6 ++++-- preprocessors/GRBL_laser_Z.py | 28 ++++++++++++++++++++++++---- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b068f6b4..ecf7784e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ CHANGELOG for FlatCAM beta - improved the running of scripts when loading from GUI a script as a FlatCAM script - fixed the `GRBL_laser` preprocessor such that it does not have a Z move at the end of the job due of the fact that this preprocessor has moves only in the X-Y plane - in Milling Plugin made sure the preprocessors that have the `laser_z` in the name (case insensitive) have the ability to change the Z height at the end of the job (through End_Z parameter) +- in Milling Plugin there was issue that did not showed the Z focus parameter for the `GRBL_laser_Z` preprocessor +- updated the `GRBL_laser_Z` preprocessor to show more complete parameter information's in the header 21.01.2022 diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index e4a92c59..ec3b2ae5 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -3199,6 +3199,8 @@ class ToolMilling(AppTool, Excellon): app_obj.inform.emit('[ERROR_NOTCL] %s...' % _('Cancelled. Empty file, it has no geometry')) return 'fail' + new_cncjob_obj.tools.update(tools_dict) + total_gcode = '' for tooluid_key in list(tools_dict.keys()): tool_cnt += 1 @@ -3416,7 +3418,8 @@ class ToolMilling(AppTool, Excellon): last_pt=last_pt, tolerance=tol, is_first=is_first, is_last=is_last, - toolchange=is_toolchange) + toolchange=is_toolchange, + use_ui=not from_tcl) if res == 'fail': self.app.log.debug("ToolMilling.mtool_gen_cncjob() --> geometry_tool_gcode_gen() failed") return 'fail' @@ -3512,13 +3515,6 @@ class ToolMilling(AppTool, Excellon): self.ui.cutzlabel.hide() self.ui.cutz_entry.hide() - if 'laser_z' not in current_pp.lower(): - self.ui.endz_label.hide() - self.ui.endz_entry.hide() - else: - self.ui.endz_label.show() - self.ui.endz_entry.show() - self.ui.travelzlabel.hide() self.ui.travelz_entry.hide() @@ -3570,7 +3566,7 @@ class ToolMilling(AppTool, Excellon): self.ui.spindle_label.setText('%s:' % _('Spindle speed')) - if ('marlin' in current_pp.lower() and 'laser' in current_pp.lower()) or 'z_laser' in current_pp.lower(): + if ('marlin' in current_pp.lower() and 'laser' in current_pp.lower()) or 'laser_z' in current_pp.lower(): self.ui.travelzlabel.setText('%s:' % _("Focus Z")) self.ui.travelzlabel.show() self.ui.travelz_entry.show() diff --git a/app_Main.py b/app_Main.py index 76324b61..fb94975d 100644 --- a/app_Main.py +++ b/app_Main.py @@ -164,7 +164,7 @@ class App(QtCore.QObject): # ############################################################################################################### version = "Unstable" # version = 8.995 - version_date = "2021/2/7" + version_date = "2022/3/1" beta = True engine = '3D' diff --git a/camlib.py b/camlib.py index 62ac10b3..b174d9b3 100644 --- a/camlib.py +++ b/camlib.py @@ -3568,7 +3568,7 @@ class CNCjob(Geometry): # used in Geometry (and soon in Tool Milling) def geometry_tool_gcode_gen(self, tool, tools, first_pt, last_pt, tolerance, is_first=False, is_last=False, - toolchange=False): + toolchange=False, use_ui=True): """ Algorithm to generate GCode from multitool Geometry. @@ -3589,6 +3589,8 @@ class CNCjob(Geometry): :type is_last: bool :param toolchange: add toolchange event :type toolchange: bool + :param use_ui: if the method is called from the GUI + :type use_ui: bool :return: GCode :rtype: str """ @@ -3610,7 +3612,7 @@ class CNCjob(Geometry): # given under the name 'toolC' self.postdata['toolC'] = float(tool_dict['tools_mill_tooldia']) self.tooldia = float(tool_dict['tools_mill_tooldia']) - self.use_ui = True + self.use_ui = use_ui self.tolerance = tolerance # Optimization type. Can be: 'M', 'B', 'T', 'R', 'No' diff --git a/preprocessors/GRBL_laser_Z.py b/preprocessors/GRBL_laser_Z.py index 6a1992fe..a731c4df 100644 --- a/preprocessors/GRBL_laser_Z.py +++ b/preprocessors/GRBL_laser_Z.py @@ -31,8 +31,30 @@ class GRBL_laser_Z(PreProc): ymin = '%.*f' % (p.coords_decimals, p['options']['ymin']) ymax = '%.*f' % (p.coords_decimals, p['options']['ymax']) - gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n' - gcode += '(Z Focus: ' + str(p['z_move']) + units + ')\n' + if p['use_ui'] is True and p['multigeo']: + gcode += '\n(TOOLS DIAMETER: )\n' + for tool, val in p['tools'].items(): + gcode += '(Tool: %s -> ' % str(tool) + 'Dia: %s' % str(val["tooldia"]) + ')\n' + gcode += '\n(FEEDRATE: )\n' + for tool, val in p['tools'].items(): + gcode += '(Tool: %s -> ' % str(tool) + 'Feedrate: %s' % \ + str(val['data']["tools_mill_feedrate"]) + ')\n' + gcode += '\n(Z FOCUS: )\n' + for tool, val in p['tools'].items(): + gcode += '(Tool: %s -> ' % str(tool) + 'Z: %s' % \ + str(val['data']["tools_mill_travelz"]) + ')\n' + gcode += '\n(LASER POWER: )\n' + for tool, val in p['tools'].items(): + gcode += '(Tool: %s -> ' % str(tool) + 'Power: %s' % \ + str(val['data']["tools_mill_spindlespeed"]) + ')\n' + else: + gcode += '(Feedrate: ' + str(p['feedrate']) + units + '/min' + ')\n' + gcode += '(Z Focus: ' + str(p['z_move']) + units + ')\n' + gcode += '(Laser Power: %s)\n' % str(p['spindlespeed']) + + gcode += '\n' + gcode += '(X-Y End: ' + str(p['xy_end']) + units + ')\n' + gcode += '(Z End: ' + str(p['z_end']) + units + ')\n' gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n' if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry': @@ -43,8 +65,6 @@ class GRBL_laser_Z(PreProc): gcode += '(X range: ' + '{: >9s}'.format(xmin) + ' ... ' + '{: >9s}'.format(xmax) + ' ' + units + ')\n' gcode += '(Y range: ' + '{: >9s}'.format(ymin) + ' ... ' + '{: >9s}'.format(ymax) + ' ' + units + ')\n\n' - gcode += '(Laser Power (Spindle Speed): ' + str(p['spindlespeed']) + ')\n\n' - gcode += ('G20' if p.units.upper() == 'IN' else 'G21') + "\n" gcode += 'G90\n' gcode += 'G17\n'