diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d4b4951..817d944d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ CHANGELOG for FlatCAM beta - fixed crash when trying to do a `select all` and there are app Scripts present - updated the `drillcncjob` Tcl command to make a script exit in case of an error - in `drillcncjob` Tcl command added the usage of `RTree` path optimization and made it the default choice +- finished the UI for adding a new parameter that is used in conjunction with the `laser` preprocessors: `laser minimum power` parameter which should help in doing a full power up/down cycle (should prolong the lifetime for the laser diode) +- fixed some UI issues for the Milling and Drilling plugins when using a `laser` preprocessor 29.01.2022 diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index c277d05d..e88684cc 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -355,6 +355,7 @@ class PreferencesUIManager: "tools_mill_z_pdepth": self.ui.plugin_pref_form.tools_mill_group.pdepth_entry, "tools_mill_feedrate_probe": self.ui.plugin_pref_form.tools_mill_group.feedrate_probe_entry, "tools_mill_spindledir": self.ui.plugin_pref_form.tools_mill_group.spindledir_radio, + "tools_mill_min_power": self.ui.plugin_pref_form.tools_mill_group.las_min_pwr_entry, "tools_mill_f_plunge": self.ui.plugin_pref_form.tools_mill_group.fplunge_cb, "tools_mill_area_exclusion": self.ui.plugin_pref_form.tools_mill_group.exclusion_cb, @@ -418,6 +419,7 @@ class PreferencesUIManager: "tools_drill_z_pdepth": self.ui.plugin_pref_form.tools_drill_group.pdepth_entry, "tools_drill_feedrate_probe": self.ui.plugin_pref_form.tools_drill_group.feedrate_probe_entry, "tools_drill_spindledir": self.ui.plugin_pref_form.tools_drill_group.spindledir_radio, + "tools_drill_min_power": self.ui.plugin_pref_form.tools_drill_group.las_min_pwr_entry, "tools_drill_f_plunge": self.ui.plugin_pref_form.tools_drill_group.fplunge_cb, "tools_drill_f_retract": self.ui.plugin_pref_form.tools_drill_group.fretract_cb, diff --git a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py index 90f2a567..c46a4252 100644 --- a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py @@ -373,6 +373,20 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): adv_grid.addWidget(spindle_dir_label, 12, 0) adv_grid.addWidget(self.spindledir_radio, 12, 1, 1, 2) + # Laser power minimum + self.las_min_pwr_label = FCLabel('%s:' % _('Min Power')) + self.las_min_pwr_label.setToolTip( + _("The laser power when the laser is travelling.") + ) + + self.las_min_pwr_entry = FCSpinner() + self.las_min_pwr_entry.set_range(0, 1000000) + self.las_min_pwr_entry.set_step(100) + + adv_grid.addWidget(self.las_min_pwr_label, 14, 0) + adv_grid.addWidget(self.las_min_pwr_entry, 14, 1) + + # Fast Plunge self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge')) self.fplunge_cb.setToolTip( _("By checking this, the vertical move from\n" @@ -380,8 +394,9 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): "meaning the fastest speed available.\n" "WARNING: the move is done at Toolchange X,Y coords.") ) - adv_grid.addWidget(self.fplunge_cb, 14, 0) + adv_grid.addWidget(self.fplunge_cb, 16, 0) + # Fast retract self.fretract_cb = FCCheckBox('%s' % _('Fast Retract')) self.fretract_cb.setToolTip( _("Exit hole strategy.\n" @@ -392,7 +407,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): "(travel height) is done as fast as possible (G0) in one move.") ) - adv_grid.addWidget(self.fretract_cb, 14, 1, 1, 2) + adv_grid.addWidget(self.fretract_cb, 16, 1, 1, 2) # separator_line = QtWidgets.QFrame() # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) diff --git a/appGUI/preferences/tools/ToolsMillPrefGroupUI.py b/appGUI/preferences/tools/ToolsMillPrefGroupUI.py index 7267465b..315fc2c6 100644 --- a/appGUI/preferences/tools/ToolsMillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsMillPrefGroupUI.py @@ -278,8 +278,8 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): self.pp_geometry_name_cb.setItemData(it, self.pp_geometry_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole) - param_grid.addWidget(pp_label, 28, 0) - param_grid.addWidget(self.pp_geometry_name_cb, 28, 1) + param_grid.addWidget(pp_label, 30, 0) + param_grid.addWidget(self.pp_geometry_name_cb, 30, 1) # separator_line = QtWidgets.QFrame() # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) @@ -406,6 +406,19 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): adv_grid.addWidget(spindle_dir_label, 12, 0) adv_grid.addWidget(self.spindledir_radio, 12, 1) + # Laser power minimum + self.las_min_pwr_label = FCLabel('%s:' % _('Min Power')) + self.las_min_pwr_label.setToolTip( + _("The laser power when the laser is travelling.") + ) + + self.las_min_pwr_entry = FCSpinner() + self.las_min_pwr_entry.set_range(0, 1000000) + self.las_min_pwr_entry.set_step(100) + + adv_grid.addWidget(self.las_min_pwr_label, 14, 0) + adv_grid.addWidget(self.las_min_pwr_entry, 14, 1) + # Fast Move from Z Toolchange self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge')) self.fplunge_cb.setToolTip( @@ -414,7 +427,7 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): "meaning the fastest speed available.\n" "WARNING: the move is done at Toolchange X,Y coords.") ) - adv_grid.addWidget(self.fplunge_cb, 14, 0, 1, 2) + adv_grid.addWidget(self.fplunge_cb, 16, 0, 1, 2) # separator_line = QtWidgets.QFrame() # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) @@ -606,7 +619,7 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) - self.overlap_entry = FCDoubleSpinner( suffix='%') + self.overlap_entry = FCDoubleSpinner(suffix='%') self.overlap_entry.set_precision(3) self.overlap_entry.setWrapping(True) self.overlap_entry.setRange(0.0000, 99.9999) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index eff5841c..fc67976b 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -1524,7 +1524,7 @@ class ToolDrilling(AppTool, Excellon): except AttributeError: pass - if 'marlin' in current_pp.lower(): + if 'laser_z' in current_pp.lower(): self.ui.travelzlabel.setText('%s:' % _("Focus Z")) self.ui.travelzlabel.show() self.ui.travelz_entry.show() @@ -1538,16 +1538,22 @@ class ToolDrilling(AppTool, Excellon): self.ui.endz_label.hide() self.ui.endz_entry.hide() - try: - self.ui.frzlabel.hide() - self.ui.feedrate_z_entry.hide() - except AttributeError: - pass + try: + self.ui.frzlabel.hide() + self.ui.feedrate_z_entry.hide() + except AttributeError: + pass self.ui.dwell_cb.hide() self.ui.dwelltime_entry.hide() self.ui.spindle_label.setText('%s:' % _("Laser Power")) + self.ui.spindle_label.setToolTip( + _("The laser power when the laser is cutting.") + ) + + self.ui.las_min_pwr_label.show() + self.ui.las_min_pwr_entry.show() try: self.ui.tool_offset_label.hide() @@ -1567,6 +1573,10 @@ class ToolDrilling(AppTool, Excellon): pass self.ui.travelzlabel.setText('%s:' % _('Travel Z')) + self.ui.travelzlabel.setToolTip( + _("Tool height when travelling\n" + "across the XY plane.") + ) self.ui.travelzlabel.show() self.ui.travelz_entry.show() @@ -1581,6 +1591,13 @@ class ToolDrilling(AppTool, Excellon): pass self.ui.spindle_label.setText('%s:' % _('Spindle speed')) + self.ui.spindle_label.setToolTip( + _("Speed of the spindle\n" + "in RPM (optional)") + ) + + self.ui.las_min_pwr_label.hide() + self.ui.las_min_pwr_entry.hide() # if in Advanced Mode if self.ui.level.isChecked(): @@ -2600,8 +2617,24 @@ class DrillingUI: self.spindlespeed_entry.set_step(100) self.spindlespeed_entry.setObjectName("e_spindlespeed") - param_grid.addWidget(self.spindle_label, 19, 0) - param_grid.addWidget(self.spindlespeed_entry, 19, 1) + param_grid.addWidget(self.spindle_label, 18, 0) + param_grid.addWidget(self.spindlespeed_entry, 18, 1) + + # Laser power minimum + self.las_min_pwr_label = FCLabel('%s:' % _('Min Power')) + self.las_min_pwr_label.setToolTip( + _("The laser power when the laser is travelling.") + ) + + self.las_min_pwr_entry = FCSpinner(callback=self.confirmation_message_int) + self.las_min_pwr_entry.set_range(0, 1000000) + self.las_min_pwr_entry.set_step(100) + self.las_min_pwr_entry.setObjectName("e_minpower") + + param_grid.addWidget(self.las_min_pwr_label, 20, 0) + param_grid.addWidget(self.las_min_pwr_entry, 20, 1) + self.las_min_pwr_label.hide() + self.las_min_pwr_entry.hide() # Dwell self.dwell_cb = FCCheckBox('%s:' % _('Dwell')) @@ -2622,8 +2655,8 @@ class DrillingUI: ) self.dwelltime_entry.setObjectName("e_dwelltime") - param_grid.addWidget(self.dwell_cb, 20, 0) - param_grid.addWidget(self.dwelltime_entry, 20, 1) + param_grid.addWidget(self.dwell_cb, 22, 0) + param_grid.addWidget(self.dwelltime_entry, 22, 1) self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 7670d9cb..ade4be40 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -3529,7 +3529,7 @@ class ToolMilling(AppTool, Excellon): self.ui.feedrate_probe_entry.setVisible(False) self.ui.feedrate_probe_label.hide() - if 'marlin' in current_pp.lower() or 'custom' in current_pp.lower(): + if 'marlin' in current_pp.lower(): self.ui.feedrate_rapid_label.show() self.ui.feedrate_rapid_entry.show() else: @@ -3540,25 +3540,42 @@ class ToolMilling(AppTool, Excellon): self.ui.cutzlabel.hide() self.ui.cutz_entry.hide() - self.ui.travelzlabel.hide() - self.ui.travelz_entry.hide() - try: self.ui.mpass_cb.hide() self.ui.maxdepth_entry.hide() except AttributeError: pass - try: - self.ui.frzlabel.hide() - self.ui.feedrate_z_entry.hide() - except AttributeError: - pass + if 'laser_z' in current_pp.lower(): + self.ui.travelzlabel.setText('%s:' % _("Focus Z")) + self.ui.travelzlabel.show() + self.ui.travelz_entry.show() + + self.ui.endz_label.show() + self.ui.endz_entry.show() + else: + self.ui.travelzlabel.hide() + self.ui.travelz_entry.hide() + + self.ui.endz_label.hide() + self.ui.endz_entry.hide() + + try: + self.ui.frzlabel.hide() + self.ui.feedrate_z_entry.hide() + except AttributeError: + pass self.ui.dwell_cb.hide() self.ui.dwelltime_entry.hide() self.ui.spindle_label.setText('%s:' % _("Laser Power")) + self.ui.spindle_label.setToolTip( + _("The laser power when the laser is cutting.") + ) + + self.ui.las_min_pwr_label.show() + self.ui.las_min_pwr_entry.show() else: self.ui.cutzlabel.show() self.ui.cutz_entry.show() @@ -3572,6 +3589,11 @@ class ToolMilling(AppTool, Excellon): pass self.ui.travelzlabel.setText('%s:' % _('Travel Z')) + self.ui.travelzlabel.setToolTip( + _("Tool height when travelling\n" + "across the XY plane.") + ) + self.ui.travelzlabel.show() self.ui.travelz_entry.show() @@ -3584,21 +3606,20 @@ class ToolMilling(AppTool, Excellon): except AttributeError: pass + self.ui.spindle_label.setText('%s:' % _('Spindle speed')) + self.ui.spindle_label.setToolTip( + _("Speed of the spindle\n" + "in RPM (optional)") + ) + + self.ui.las_min_pwr_label.hide() + self.ui.las_min_pwr_entry.hide() + # if in Advanced Mode if self.ui.level.isChecked(): self.ui.dwell_cb.show() self.ui.dwelltime_entry.show() - self.ui.spindle_label.setText('%s:' % _('Spindle speed')) - - 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() - - self.ui.endz_label.show() - self.ui.endz_entry.show() - def on_plot_cb_click(self): self.target_obj.plot() @@ -3847,7 +3868,7 @@ class ToolMilling(AppTool, Excellon): self.builduiSig.emit() def reset_fields(self): - self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) + self.ui.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) class MillingUI: @@ -4661,6 +4682,22 @@ class MillingUI: param_grid.addWidget(self.spindle_label, 44, 0) param_grid.addWidget(self.spindlespeed_entry, 44, 1) + # Laser power minimum + self.las_min_pwr_label = FCLabel('%s:' % _('Min Power')) + self.las_min_pwr_label.setToolTip( + _("The laser power when the laser is travelling.") + ) + + self.las_min_pwr_entry = FCSpinner(callback=self.confirmation_message_int) + self.las_min_pwr_entry.set_range(0, 1000000) + self.las_min_pwr_entry.set_step(100) + self.las_min_pwr_entry.setObjectName("mill_minpower") + + param_grid.addWidget(self.las_min_pwr_label, 45, 0) + param_grid.addWidget(self.las_min_pwr_entry, 45, 1) + self.las_min_pwr_label.hide() + self.las_min_pwr_entry.hide() + # Dwell self.dwell_cb = FCCheckBox('%s:' % _('Dwell')) self.dwell_cb.setToolTip( diff --git a/defaults.py b/defaults.py index 96911b8b..c6dcf1ba 100644 --- a/defaults.py +++ b/defaults.py @@ -400,6 +400,7 @@ class FlatCAMDefaults: "tools_drill_spindlespeed": 0, "tools_drill_dwell": False, "tools_drill_dwelltime": 1, + "tools_drill_min_power": 0.0, "tools_drill_toolchange": False, "tools_drill_toolchangez": 15, "tools_drill_preprocessor_list": ['default'], @@ -446,6 +447,7 @@ class FlatCAMDefaults: "tools_mill_feedrate": 120, "tools_mill_feedrate_z": 60, + "tools_mill_min_power": 0.0, "tools_mill_spindlespeed": 0, "tools_mill_dwell": False, "tools_mill_dwelltime": 1, diff --git a/preprocessors/GRBL_laser_Z.py b/preprocessors/GRBL_laser_z.py similarity index 99% rename from preprocessors/GRBL_laser_Z.py rename to preprocessors/GRBL_laser_z.py index d1d956f4..034bb0f4 100644 --- a/preprocessors/GRBL_laser_Z.py +++ b/preprocessors/GRBL_laser_z.py @@ -14,7 +14,7 @@ from appPreProcessor import * # is compatible with almost any version of Grbl. -class GRBL_laser_Z(PreProc): +class GRBL_laser_z(PreProc): include_header = True coordinate_format = "%.*f"