From 569a30ee52ec2532867f7a05a47854066ec38a8a Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 6 Dec 2023 21:00:07 +0200 Subject: [PATCH] - Drilling and Milling Tools: added support to choose the GCode for turning On the laser --- CHANGELOG.md | 3 +- appDatabase.py | 6 +- appEditors/AppExcEditor.py | 2 +- appGUI/preferences/PreferencesUIManager.py | 14 +- .../geometry/GeometryAdvOptPrefGroupUI.py | 36 ++-- .../tools/ToolsDrillPrefGroupUI.py | 17 +- .../preferences/tools/ToolsMillPrefGroupUI.py | 12 ++ appObjects/GeometryObject.py | 40 ++--- appPlugins/ToolDrilling.py | 54 ++++-- appPlugins/ToolMilling.py | 154 ++++++++++-------- appPlugins/ToolSolderPaste.py | 2 +- camlib.py | 39 +++-- defaults.py | 16 +- locale/de/LC_MESSAGES/strings.po | 8 +- locale/en/LC_MESSAGES/strings.po | 8 +- locale/es/LC_MESSAGES/strings.po | 8 +- locale/fr/LC_MESSAGES/strings.po | 8 +- locale/it/LC_MESSAGES/strings.po | 8 +- locale/pt_BR/LC_MESSAGES/strings.po | 4 +- locale/ro/LC_MESSAGES/strings.po | 6 +- locale/ru/LC_MESSAGES/strings.po | 8 +- locale/tr/LC_MESSAGES/strings.po | 8 +- preprocessors/GRBL_laser.py | 12 +- preprocessors/GRBL_laser_z.py | 10 +- preprocessors/Marlin_laser_FAN_pin.py | 2 +- preprocessors/Marlin_laser_Spindle_pin.py | 13 +- preprocessors/Marlin_laser_z.py | 11 +- preprocessors/Toolchange_Probe_MACH3.py | 24 +-- preprocessors/default_laser.py | 12 +- preprocessors/grbl_laser_eleks_drd.py | 11 +- tclCommands/TclCommandCncjob.py | 6 +- tclCommands/TclCommandCopperClear.py | 4 +- tclCommands/TclCommandPaint.py | 4 +- 33 files changed, 329 insertions(+), 241 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8946290f..0f3ecaec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM Evo beta - Paint Tool: fixed the calculation of object bounds - camlib: updated the method used to calculate the extrapolated lines for the laser_lines method: camlib.fill_with_lines() +- Drilling and Milling Tools: added support to choose the GCode for turning On the laser 25.11.2023 @@ -826,7 +827,7 @@ CHANGELOG for FlatCAM Evo beta - refactored the Isolation Plugin class - some more work on the Isolation plugin -- fixed more issues in the `ncc` and `paint` Tcl commands (missing `segx` and `segy` keys) +- fixed more issues in the `ncc` and `paint` Tcl commands (missing `seg_x` and `seg_y` keys) - fixed not adding the feedrate code in `drillcncjob` Tcl command - 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 diff --git a/appDatabase.py b/appDatabase.py index 03b1aacd..7349a945 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -1929,15 +1929,15 @@ class ToolsDB2(QtWidgets.QWidget): "tools_mill_endz": float(self.app.options["tools_mill_endz"]), "tools_mill_endxy": self.app.options["tools_mill_endxy"], "tools_mill_search_time": int(self.app.options["tools_mill_search_time"]), - "tools_mill_z_pdepth": float(self.app.options["tools_mill_z_pdepth"]), + "tools_mill_z_p_depth": float(self.app.options["tools_mill_z_p_depth"]), "tools_mill_f_plunge": float(self.app.options["tools_mill_f_plunge"]), "tools_mill_spindledir": self.app.options["tools_mill_spindledir"], "tools_mill_optimization_type": self.app.options["tools_mill_optimization_type"], "tools_mill_feedrate_probe": self.app.options["tools_mill_feedrate_probe"], - "segx": self.app.options["geometry_segx"], - "segy": self.app.options["geometry_segy"], + "seg_x": self.app.options["geometry_seg_x"], + "seg_y": self.app.options["geometry_seg_y"], "tools_mill_area_exclusion": self.app.options["tools_mill_area_exclusion"], "tools_mill_area_shape": self.app.options["tools_mill_area_shape"], "tools_mill_area_strategy": self.app.options["tools_mill_area_strategy"], diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py index 37a0f1ba..ed25b76c 100644 --- a/appEditors/AppExcEditor.py +++ b/appEditors/AppExcEditor.py @@ -4031,7 +4031,7 @@ class AppExcEditor(QtCore.QObject): "tools_drill_dwell": self.app.options["tools_drill_dwell"], "tools_drill_dwelltime": self.app.options["tools_drill_dwelltime"], "tools_drill_ppname_e": self.app.options["tools_drill_ppname_e"], - "tools_drill_z_pdepth": self.app.options["tools_drill_z_pdepth"], + "tools_drill_z_p_depth": self.app.options["tools_drill_z_p_depth"], "tools_drill_feedrate_probe": self.app.options["tools_drill_feedrate_probe"], "tools_drill_spindledir": self.app.options["tools_drill_spindledir"], "tools_drill_f_plunge": self.app.options["tools_drill_f_plunge"], diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index d684d170..d277a876 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -264,8 +264,8 @@ class PreferencesUIManager(QtCore.QObject): "geometry_plot_line": self.ui.geo_pref_form.geometry_gen_group.line_color_entry, # Geometry Options - "geometry_segx": self.ui.geo_pref_form.geometry_adv_opt_group.segx_entry, - "geometry_segy": self.ui.geo_pref_form.geometry_adv_opt_group.segy_entry, + "geometry_seg_x": self.ui.geo_pref_form.geometry_adv_opt_group.seg_x_entry, + "geometry_seg_y": self.ui.geo_pref_form.geometry_adv_opt_group.seg_y_entry, # Geometry Export "geometry_dxf_format": self.ui.geo_pref_form.geometry_exp_group.dxf_format_combo, @@ -374,10 +374,13 @@ class PreferencesUIManager(QtCore.QObject): "tools_mill_feedrate_rapid": self.ui.plugin_pref_form.tools_mill_group.feedrate_rapid_entry, "tools_mill_extracut": self.ui.plugin_pref_form.tools_mill_group.extracut_cb, "tools_mill_extracut_length": self.ui.plugin_pref_form.tools_mill_group.e_cut_entry, - "tools_mill_z_pdepth": self.ui.plugin_pref_form.tools_mill_group.pdepth_entry, + "tools_mill_z_p_depth": 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_laser_on": self.ui.plugin_pref_form.tools_mill_group.laser_turn_on_combo, + "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, @@ -440,10 +443,13 @@ class PreferencesUIManager(QtCore.QObject): "tools_drill_toolchangexy": self.ui.plugin_pref_form.tools_drill_group.toolchangexy_entry, "tools_drill_startz": self.ui.plugin_pref_form.tools_drill_group.estartz_entry, "tools_drill_feedrate_rapid": self.ui.plugin_pref_form.tools_drill_group.feedrate_rapid_entry, - "tools_drill_z_pdepth": self.ui.plugin_pref_form.tools_drill_group.pdepth_entry, + "tools_drill_z_p_depth": 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_laser_on": self.ui.plugin_pref_form.tools_drill_group.laser_turn_on_combo, + "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/geometry/GeometryAdvOptPrefGroupUI.py b/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py index 14c8d90f..0f6a184c 100644 --- a/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py @@ -40,35 +40,35 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): adv_frame.setLayout(adv_grid) # Size of trace segment on X axis - segx_label = FCLabel('%s:' % _("Segment X size")) - segx_label.setToolTip( + seg_x_label = FCLabel('%s:' % _("Segment X size")) + seg_x_label.setToolTip( _("The size of the trace segment on the X axis.\n" "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the X axis.") ) - self.segx_entry = FCDoubleSpinner() - self.segx_entry.set_range(0, 99999) - self.segx_entry.set_precision(self.decimals) - self.segx_entry.setSingleStep(0.1) - self.segx_entry.setWrapping(True) + self.seg_x_entry = FCDoubleSpinner() + self.seg_x_entry.set_range(0, 99999) + self.seg_x_entry.set_precision(self.decimals) + self.seg_x_entry.setSingleStep(0.1) + self.seg_x_entry.setWrapping(True) - adv_grid.addWidget(segx_label, 0, 0) - adv_grid.addWidget(self.segx_entry, 0, 1) + adv_grid.addWidget(seg_x_label, 0, 0) + adv_grid.addWidget(self.seg_x_entry, 0, 1) # Size of trace segment on Y axis - segy_label = FCLabel('%s:' % _("Segment Y size")) - segy_label.setToolTip( + seg_y_label = FCLabel('%s:' % _("Segment Y size")) + seg_y_label.setToolTip( _("The size of the trace segment on the Y axis.\n" "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the Y axis.") ) - self.segy_entry = FCDoubleSpinner() - self.segy_entry.set_range(0, 99999) - self.segy_entry.set_precision(self.decimals) - self.segy_entry.setSingleStep(0.1) - self.segy_entry.setWrapping(True) + self.seg_y_entry = FCDoubleSpinner() + self.seg_y_entry.set_range(0, 99999) + self.seg_y_entry.set_precision(self.decimals) + self.seg_y_entry.setSingleStep(0.1) + self.seg_y_entry.setWrapping(True) - adv_grid.addWidget(segy_label, 2, 0) - adv_grid.addWidget(self.segy_entry, 2, 1) + adv_grid.addWidget(seg_y_label, 2, 0) + adv_grid.addWidget(self.seg_y_entry, 2, 1) # self.layout.addStretch() diff --git a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py index b48e6d5c..17f2b441 100644 --- a/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsDrillPrefGroupUI.py @@ -387,6 +387,19 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): adv_grid.addWidget(self.las_min_pwr_label, 14, 0) adv_grid.addWidget(self.las_min_pwr_entry, 14, 1) + # Laser Turn ON Code + self.laser_turn_on_lbl = FCLabel('%s:' % _('Turn ON Code')) + self.laser_turn_on_lbl.setToolTip( + _("The Gode that will be executed to turn the laser on.") + ) + + self.laser_turn_on_combo = FCComboBox() + self.laser_turn_on_combo.addItems(["M3", "M4"]) + self.laser_turn_on_combo.setObjectName("e_laser_turn_on") + + adv_grid.addWidget(self.laser_turn_on_lbl, 16, 0) + adv_grid.addWidget(self.laser_turn_on_combo, 16, 1) + # Fast Plunge self.fplunge_cb = FCCheckBox('%s' % _('Fast Plunge')) self.fplunge_cb.setToolTip( @@ -395,7 +408,7 @@ 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, 16, 0) + adv_grid.addWidget(self.fplunge_cb, 18, 0) # Fast retract self.fretract_cb = FCCheckBox('%s' % _('Fast Retract')) @@ -408,7 +421,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI): "(travel height) is done as fast as possible (G0) in one move.") ) - adv_grid.addWidget(self.fretract_cb, 16, 1, 1, 2) + adv_grid.addWidget(self.fretract_cb, 18, 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 4e3609e5..338c27e5 100644 --- a/appGUI/preferences/tools/ToolsMillPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsMillPrefGroupUI.py @@ -430,6 +430,18 @@ class ToolsMillPrefGroupUI(OptionsGroupUI): ) adv_grid.addWidget(self.fplunge_cb, 16, 0, 1, 2) + # Laser Turn ON Code + self.laser_turn_on_lbl = FCLabel('%s:' % _('Turn ON Code')) + self.laser_turn_on_lbl.setToolTip( + _("The Gode that will be executed to turn the laser on.") + ) + + self.laser_turn_on_combo = FCComboBox() + self.laser_turn_on_combo.addItems(["M3", "M4"]) + + adv_grid.addWidget(self.laser_turn_on_lbl, 18, 0) + adv_grid.addWidget(self.laser_turn_on_combo, 18, 1) + # separator_line = QtWidgets.QFrame() # separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) diff --git a/appObjects/GeometryObject.py b/appObjects/GeometryObject.py index 2f44577f..38d18d31 100644 --- a/appObjects/GeometryObject.py +++ b/appObjects/GeometryObject.py @@ -89,7 +89,7 @@ class GeometryObject(FlatCAMObj, Geometry): "tools_mill_toolchangez": 1.0, "tools_mill_toolchangexy": "0.0, 0.0", "tools_mill_ppname_g": 'default', - "tools_mill_z_pdepth": -0.02, + "tools_mill_z_p_depth": -0.02, "tools_mill_feedrate_probe": 3.0, }) @@ -631,7 +631,7 @@ class GeometryObject(FlatCAMObj, Geometry): return dwg - def mtool_gen_cncjob(self, outname=None, tools_dict=None, segx=None, segy=None, + def mtool_gen_cncjob(self, outname=None, tools_dict=None, seg_x=None, seg_y=None, plot=True, use_thread=True): """ Creates a multi-tool CNCJob out of this Geometry object. @@ -641,8 +641,8 @@ class GeometryObject(FlatCAMObj, Geometry): :param outname: :param tools_dict: a dictionary that holds the whole data needed to create the Gcode (including the solid_geometry) - :param segx: number of segments on the X axis, for auto-levelling - :param segy: number of segments on the Y axis, for auto-levelling + :param seg_x: number of segments on the X axis, for auto-levelling + :param seg_y: number of segments on the Y axis, for auto-levelling :param plot: if True the generated object will be plotted; if False will not be plotted :param use_thread: if True use threading :return: None @@ -652,8 +652,8 @@ class GeometryObject(FlatCAMObj, Geometry): outname = "%s_%s" % (self.obj_options["name"], 'cnc') if outname is None else outname tools_dict = self.sel_tools if tools_dict is None else tools_dict - segx = segx if segx is not None else float(self.app.options['geometry_segx']) - segy = segy if segy is not None else float(self.app.options['geometry_segy']) + seg_x = seg_x if seg_x is not None else float(self.app.options['geometry_seg_x']) + seg_y = seg_y if seg_y is not None else float(self.app.options['geometry_seg_y']) try: xmin = self.obj_options['xmin'] @@ -693,10 +693,10 @@ class GeometryObject(FlatCAMObj, Geometry): job_obj.multigeo = False job_obj.tools.clear() - job_obj.segx = segx if segx else float(self.app.options["geometry_segx"]) - job_obj.segy = segy if segy else float(self.app.options["geometry_segy"]) + job_obj.seg_x = seg_x if seg_x else float(self.app.options["geometry_seg_x"]) + job_obj.seg_y = seg_y if seg_y else float(self.app.options["geometry_seg_y"]) - job_obj.z_pdepth = float(self.app.options["tools_mill_z_pdepth"]) + job_obj.z_p_depth = float(self.app.options["tools_mill_z_p_depth"]) job_obj.feedrate_probe = float(self.app.options["tools_mill_feedrate_probe"]) total_gcode = '' @@ -835,10 +835,10 @@ class GeometryObject(FlatCAMObj, Geometry): job_obj.multigeo = True job_obj.tools.clear() - job_obj.segx = segx if segx else float(self.app.options["geometry_segx"]) - job_obj.segy = segy if segy else float(self.app.options["geometry_segy"]) + job_obj.seg_x = seg_x if seg_x else float(self.app.options["geometry_seg_x"]) + job_obj.seg_y = seg_y if seg_y else float(self.app.options["geometry_seg_y"]) - job_obj.z_pdepth = float(self.app.options["tools_mill_z_pdepth"]) + job_obj.z_p_depth = float(self.app.options["tools_mill_z_p_depth"]) job_obj.feedrate_probe = float(self.app.options["tools_mill_feedrate_probe"]) # make sure that trying to make a CNCJob from an empty file is not creating an app crash @@ -993,7 +993,7 @@ class GeometryObject(FlatCAMObj, Geometry): las_min_pwr=0.0, multidepth=None, dpp=None, toolchange=None, toolchangez=None, toolchangexy=None, extracut=None, extracut_length=None, startz=None, endz=None, endxy=None, pp=None, - segx=None, segy=None, use_thread=True, plot=True, **args): + seg_x=None, seg_y=None, use_thread=True, plot=True, **args): """ Only used by the TCL Command Cncjob. Creates a CNCJob out of this Geometry object. The actual @@ -1025,8 +1025,8 @@ class GeometryObject(FlatCAMObj, Geometry): :param endxy: A sequence ox X,Y coordinates: a 2-length tuple or a string. Coordinates in X, Y plane for the last move after ending the job. :param pp: Name of the preprocessor - :param segx: - :param segy: + :param seg_x: + :param seg_y: :param use_thread: :param plot: :return: None @@ -1048,8 +1048,8 @@ class GeometryObject(FlatCAMObj, Geometry): multidepth = multidepth if multidepth is not None else self.obj_options["tools_mill_multidepth"] depthperpass = dpp if dpp is not None else float(self.obj_options["tools_mill_depthperpass"]) - segx = segx if segx is not None else float(self.app.options['geometry_segx']) - segy = segy if segy is not None else float(self.app.options['geometry_segy']) + seg_x = seg_x if seg_x is not None else float(self.app.options['geometry_seg_x']) + seg_y = seg_y if seg_y is not None else float(self.app.options['geometry_seg_y']) extracut = extracut if extracut is not None else float(self.obj_options["tools_mill_extracut"]) extracut_length = extracut_length if extracut_length is not None else float(self.obj_options[ @@ -1099,10 +1099,10 @@ class GeometryObject(FlatCAMObj, Geometry): job_obj.obj_options['type'] = 'Geometry' job_obj.obj_options['tool_dia'] = tooldia - job_obj.segx = segx - job_obj.segy = segy + job_obj.seg_x = seg_x + job_obj.seg_y = seg_y - job_obj.z_pdepth = float(self.obj_options["tools_mill_z_pdepth"]) + job_obj.z_p_depth = float(self.obj_options["tools_mill_z_p_depth"]) job_obj.feedrate_probe = float(self.obj_options["tools_mill_feedrate_probe"]) job_obj.obj_options['xmin'] = self.obj_options['xmin'] diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index 265e3083..929f33b1 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -205,7 +205,7 @@ class ToolDrilling(AppTool, Excellon): self.ui.search_load_db_btn.clicked.connect(self.on_tool_db_load) self.ui.apply_param_to_all.clicked.connect(self.on_apply_param_to_all_clicked) - self.ui.generate_cnc_button.clicked.connect(self.on_cnc_button_click) + self.ui.generate_cnc_button.clicked.connect(self.on_generate_cnc_job) self.ui.tools_table.drag_drop_sig.connect(self.rebuild_ui) # Exclusion areas signals @@ -353,7 +353,7 @@ class ToolDrilling(AppTool, Excellon): "tools_drill_spindlespeed": self.ui.spindlespeed_entry, "tools_drill_min_power": self.ui.las_min_pwr_entry, - + "tools_drill_laser_on": self.ui.laser_turn_on_combo, "tools_drill_dwell": self.ui.dwell_cb, "tools_drill_dwelltime": self.ui.dwelltime_entry, @@ -373,7 +373,7 @@ class ToolDrilling(AppTool, Excellon): "tools_drill_endz": self.ui.endz_entry, "tools_drill_endxy": self.ui.endxy_entry, - "tools_drill_z_pdepth": self.ui.pdepth_entry, + "tools_drill_z_p_depth": self.ui.pdepth_entry, "tools_drill_feedrate_probe": self.ui.feedrate_probe_entry, "tools_drill_ppname_e": self.ui.pp_excellon_name_cb, @@ -394,6 +394,7 @@ class ToolDrilling(AppTool, Excellon): "e_spindlespeed": "tools_drill_spindlespeed", "e_minpower": "tools_drill_min_power", + "e_laser_turn_on": "tools_drill_laser_on", "e_dwell": "tools_drill_dwell", "e_dwelltime": "tools_drill_dwelltime", @@ -413,7 +414,7 @@ class ToolDrilling(AppTool, Excellon): "e_endz": "tools_drill_endz", "e_endxy": "tools_drill_endxy", - "e_depth_probe": "tools_drill_z_pdepth", + "e_depth_probe": "tools_drill_z_p_depth", "e_fr_probe": "tools_drill_feedrate_probe", "e_pp": "tools_drill_ppname_e", @@ -1577,6 +1578,9 @@ class ToolDrilling(AppTool, Excellon): self.ui.las_min_pwr_label.show() self.ui.las_min_pwr_entry.show() + self.ui.laser_turn_on_lbl.show() + self.ui.laser_turn_on_combo.show() + try: self.ui.tool_offset_label.hide() self.ui.offset_entry.hide() @@ -1621,6 +1625,9 @@ class ToolDrilling(AppTool, Excellon): self.ui.las_min_pwr_label.hide() self.ui.las_min_pwr_entry.hide() + self.ui.laser_turn_on_lbl.hide() + self.ui.laser_turn_on_combo.hide() + # if in Advanced Mode if self.ui.level.isChecked(): self.ui.dwell_cb.show() @@ -1957,7 +1964,7 @@ class ToolDrilling(AppTool, Excellon): return True return False - def on_cnc_button_click(self): + def on_generate_cnc_job(self): obj_name = self.ui.object_combo.currentText() # toolchange = self.ui.toolchange_cb.get_value() # determine if we have toolchange event or not @@ -2200,8 +2207,8 @@ class ToolDrilling(AppTool, Excellon): # it does not matter for the Excellon codes because we are not going to autolevel GCode out of Excellon # but it is here for uniformity between the Geometry and Excellon objects - cnc_job_obj.segx = self.app.options["geometry_segx"] - cnc_job_obj.segy = self.app.options["geometry_segy"] + cnc_job_obj.seg_x = self.app.options["geometry_seg_x"] + cnc_job_obj.seg_y = self.app.options["geometry_seg_y"] # first drill point # I can read the toolchange x,y point from any tool since it is the same for all, so I read it @@ -2667,7 +2674,7 @@ class DrillingUI: 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.set_step(1) self.las_min_pwr_entry.setObjectName("e_minpower") param_grid.addWidget(self.las_min_pwr_label, 20, 0) @@ -2675,6 +2682,21 @@ class DrillingUI: self.las_min_pwr_label.hide() self.las_min_pwr_entry.hide() + # Laser Turn ON Code + self.laser_turn_on_lbl = FCLabel('%s:' % _('Turn ON Code')) + self.laser_turn_on_lbl.setToolTip( + _("The Gode that will be executed to turn the laser on.") + ) + + self.laser_turn_on_combo = FCComboBox() + self.laser_turn_on_combo.addItems(["M3", "M4"]) + self.laser_turn_on_combo.setObjectName("e_laser_turn_on") + + param_grid.addWidget(self.laser_turn_on_lbl, 22, 0) + param_grid.addWidget(self.laser_turn_on_combo, 22, 1) + self.laser_turn_on_lbl.hide() + self.laser_turn_on_combo.hide() + # Dwell self.dwell_cb = FCCheckBox('%s:' % _('Dwell')) self.dwell_cb.setToolTip( @@ -2694,8 +2716,8 @@ class DrillingUI: ) self.dwelltime_entry.setObjectName("e_dwelltime") - param_grid.addWidget(self.dwell_cb, 22, 0) - param_grid.addWidget(self.dwelltime_entry, 22, 1) + param_grid.addWidget(self.dwell_cb, 24, 0) + param_grid.addWidget(self.dwelltime_entry, 24, 1) self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) @@ -2712,8 +2734,8 @@ class DrillingUI: self.offset_entry.set_range(-10000.0000, 10000.0000) self.offset_entry.setObjectName("e_offset") - param_grid.addWidget(self.tool_offset_label, 25, 0) - param_grid.addWidget(self.offset_entry, 25, 1) + param_grid.addWidget(self.tool_offset_label, 26, 0) + param_grid.addWidget(self.offset_entry, 26, 1) # Drill slots self.drill_slots_cb = FCCheckBox('%s' % _('Drill slots')) @@ -2721,7 +2743,7 @@ class DrillingUI: _("If the selected tool has slots then they will be drilled.") ) self.drill_slots_cb.setObjectName("e_drill_slots") - param_grid.addWidget(self.drill_slots_cb, 27, 0, 1, 2) + param_grid.addWidget(self.drill_slots_cb, 28, 0, 1, 2) # Drill Overlap self.drill_overlap_label = FCLabel('%s:' % _('Overlap')) @@ -2736,8 +2758,8 @@ class DrillingUI: self.drill_overlap_entry.setObjectName("e_drill_slots_overlap") - param_grid.addWidget(self.drill_overlap_label, 28, 0) - param_grid.addWidget(self.drill_overlap_entry, 28, 1) + param_grid.addWidget(self.drill_overlap_label, 30, 0) + param_grid.addWidget(self.drill_overlap_entry, 30, 1) # Last drill in slot self.last_drill_cb = FCCheckBox('%s' % _('Last drill')) @@ -2746,7 +2768,7 @@ class DrillingUI: "add a drill hole on the slot end point.") ) self.last_drill_cb.setObjectName("e_drill_last_drill") - param_grid.addWidget(self.last_drill_cb, 30, 0, 1, 2) + param_grid.addWidget(self.last_drill_cb, 32, 0, 1, 2) self.drill_overlap_label.hide() self.drill_overlap_entry.hide() diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index 0cb14b0a..98990110 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -274,7 +274,7 @@ class ToolMilling(AppTool, Excellon): self.ui.tools_table_mill_geo.horizontalHeader().sectionClicked.connect(self.on_toggle_all_rows) # Generate CNCJob - self.launch_job.connect(self.mtool_gen_cncjob) + self.launch_job.connect(self.generate_cnc_job_handler) self.ui.generate_cnc_button.clicked.connect(self.on_generate_cncjob_click) # Reset Tool @@ -521,6 +521,7 @@ class ToolMilling(AppTool, Excellon): "tools_mill_dwell": self.ui.dwell_cb, "tools_mill_dwelltime": self.ui.dwelltime_entry, "tools_mill_min_power": self.ui.las_min_pwr_entry, + "tools_mill_laser_on": self.ui.laser_turn_on_combo } self.general_form_fields = { @@ -531,11 +532,11 @@ class ToolMilling(AppTool, Excellon): "tools_mill_endz": self.ui.endz_entry, "tools_mill_endxy": self.ui.endxy_entry, - "tools_mill_z_pdepth": self.ui.pdepth_entry, + "tools_mill_z_p_depth": self.ui.pdepth_entry, "tools_mill_feedrate_probe": self.ui.feedrate_probe_entry, "tools_mill_ppname_g": self.ui.pp_geo_name_cb, - "segx": self.ui.segx_entry, - "segy": self.ui.segy_entry, + "seg_x": self.ui.seg_x_entry, + "seg_y": self.ui.seg_y_entry, # "gcode_type": self.ui.excellon_gcode_type_radio, "tools_mill_area_exclusion": self.ui.exclusion_cb, @@ -579,6 +580,7 @@ class ToolMilling(AppTool, Excellon): "mill_dwell": "tools_mill_dwell", "mill_dwelltime": "tools_mill_dwelltime", "mill_minpower": "tools_mill_min_power", + "mill_laser_turn_on": "tools_mill_laser_on", # General Parameters "mill_toolchange": "tools_mill_toolchange", @@ -588,11 +590,11 @@ class ToolMilling(AppTool, Excellon): "mill_endz": "tools_mill_endz", "mill_endxy": "tools_mill_endxy", - "mill_depth_probe": "tools_mill_z_pdepth", + "mill_depth_probe": "tools_mill_z_p_depth", "mill_fr_probe": "tools_mill_feedrate_probe", "mill_ppname_g": "tools_mill_ppname_g", - "mill_segx": "segx", - "mill_segy": "segy", + "mill_seg_x": "seg_x", + "mill_seg_y": "seg_y", "mill_exclusion": "tools_mill_area_exclusion", "mill_area_shape": "tools_mill_area_shape", @@ -2739,7 +2741,7 @@ class ToolMilling(AppTool, Excellon): return if self.target_obj.kind == 'geometry': - self.on_generatecnc_from_geo() + self.on_generate_cnc_from_geo() elif self.target_obj.kind == 'excellon': self.on_generatecnc_from_exc() @@ -2904,8 +2906,8 @@ class ToolMilling(AppTool, Excellon): 'solid_geometry': deepcopy(total_geometry) } new_obj.tools[tool]['data']['tools_mill_tooldia'] = mill_dia - new_obj.tools[tool]['data']['segx'] = self.app.options['geometry_segx'] - new_obj.tools[tool]['data']['segy'] = self.app.options['geometry_segy'] + new_obj.tools[tool]['data']['seg_x'] = self.app.options['geometry_seg_x'] + new_obj.tools[tool]['data']['seg_y'] = self.app.options['geometry_seg_y'] # if not total_tool_geo: # self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed. Nothing to mill ...")) @@ -2915,9 +2917,9 @@ class ToolMilling(AppTool, Excellon): # a milled geometry (either drills or slots or both) not a total sum. # painting the polygons - self.mtool_gen_cncjob(geo_obj=new_obj, tools_dict=new_obj.tools, disable_offset=True) + self.generate_cnc_job_handler(geo_obj=new_obj, tools_dict=new_obj.tools, disable_offset=True) - def on_generatecnc_from_geo(self): + def on_generate_cnc_from_geo(self): self.app.log.debug("Generating CNCJob from Geometry ...") self.sel_tools.clear() @@ -2959,7 +2961,7 @@ class ToolMilling(AppTool, Excellon): tooluid: deepcopy(tooluid_value) }) - self.mtool_gen_cncjob() + self.generate_cnc_job_handler() # self.ui.tools_table_mill_geo.clearSelection() elif self.ui.tools_table_mill_geo.rowCount() == 1: @@ -2970,7 +2972,7 @@ class ToolMilling(AppTool, Excellon): self.sel_tools.update({ tooluid: deepcopy(tooluid_value) }) - self.mtool_gen_cncjob() + self.generate_cnc_job_handler() # self.ui.tools_table_mill_geo.clearSelection() else: self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No tool selected in the tool table ...")) @@ -2981,8 +2983,9 @@ class ToolMilling(AppTool, Excellon): # float(self.sel_tools[tooluid_key]['data']['tools_mill_tooldia']), self.decimals) # print(tooldia_val) - def mtool_gen_cncjob(self, geo_obj=None, outname=None, tools_dict=None, tools_in_use=None, segx=None, segy=None, - toolchange=None, plot=True, use_thread=True, disable_offset=False, from_tcl=False): + def generate_cnc_job_handler(self, geo_obj=None, outname=None, tools_dict=None, tools_in_use=None, + seg_x=None, seg_y=None, toolchange=None, plot=True, use_thread=True, + disable_offset=False, from_tcl=False): """ Creates a multi-tool CNCJob out of this Geometry object. The actual work is done by the target CNCJobObject object's @@ -2995,8 +2998,8 @@ class ToolMilling(AppTool, Excellon): (including the solid_geometry) :param tools_in_use: the tools that are used, needed by some preprocessors :type tools_in_use list of lists, each list in the list is made out of row elements of tools table from GUI - :param segx: number of segments on the X axis, for auto-levelling - :param segy: number of segments on the Y axis, for auto-levelling + :param seg_x: number of segments on the X axis, for auto-levelling + :param seg_y: number of segments on the Y axis, for auto-levelling :param plot: if True the generated object will be plotted; if False will not be plotted :param use_thread: if True use threading :param disable_offset: If True then the set offset for each tool will not be used @@ -3004,7 +3007,7 @@ class ToolMilling(AppTool, Excellon): :return: None """ - self.app.log.debug("ToolMilling.mtool_gen_cncjob()") + self.app.log.debug("ToolMilling.generate_cnc_job_handler()") geo_obj = geo_obj if geo_obj is not None else self.target_obj @@ -3014,33 +3017,33 @@ class ToolMilling(AppTool, Excellon): tools_dict = self.sel_tools if tools_dict is None else tools_dict if not geo_obj.tools: - segx = segx if segx is not None else float(geo_obj.obj_options['segx']) - segy = segy if segy is not None else float(geo_obj.obj_options['segy']) + seg_x = seg_x if seg_x is not None else float(geo_obj.obj_options['seg_x']) + seg_y = seg_y if seg_y is not None else float(geo_obj.obj_options['seg_y']) else: tools_list = list(geo_obj.tools.keys()) - # the segx and segy values are the same for all tools os we just take the values from the first tool + # the seg_x and seg_y values are the same for all tools os we just take the values from the first tool sel_tool = tools_list[0] data_dict = geo_obj.tools[sel_tool]['data'] try: - segx = data_dict['segx'] + seg_x = data_dict['seg_x'] except KeyError: try: - segx = data_dict['geometry_segx'] + seg_x = data_dict['geometry_seg_x'] except KeyError: try: - segx = geo_obj.obj_options['segx'] + seg_x = geo_obj.obj_options['seg_x'] except KeyError: - segx = self.app.options['geometry_segx'] + seg_x = self.app.options['geometry_seg_x'] try: - segy = data_dict['segy'] + seg_y = data_dict['seg_y'] except KeyError: try: - segy = data_dict['geometry_segy'] + seg_y = data_dict['geometry_seg_y'] except KeyError: try: - segy = geo_obj.obj_options['segy'] + seg_y = geo_obj.obj_options['seg_y'] except KeyError: - segy = self.app.options['geometry_segy'] + seg_y = self.app.options['geometry_seg_y'] try: xmin = geo_obj.obj_options['xmin'] @@ -3082,10 +3085,10 @@ class ToolMilling(AppTool, Excellon): new_cncjob_obj.multigeo = False new_cncjob_obj.tools.clear() - new_cncjob_obj.segx = segx - new_cncjob_obj.segy = segy + new_cncjob_obj.seg_x = seg_x + new_cncjob_obj.seg_y = seg_y - new_cncjob_obj.z_pdepth = float(geo_obj.obj_options["tools_mill_z_pdepth"]) + new_cncjob_obj.z_p_depth = float(geo_obj.obj_options["tools_mill_z_p_depth"]) new_cncjob_obj.feedrate_probe = float(geo_obj.obj_options["tools_mill_feedrate_probe"]) used_tools = list(tools_dict.keys()) @@ -3153,6 +3156,7 @@ class ToolMilling(AppTool, Excellon): dwell = tools_dict[tooluid_key]['data']["tools_mill_dwell"] dwelltime = tools_dict[tooluid_key]['data']["tools_mill_dwelltime"] laser_min_power = tools_dict[tooluid_key]['data']["tools_mill_min_power"] + laser_on_code = tools_dict[tooluid_key]['data']["tools_mill_laser_on"] pp_geometry_name = tools_dict[tooluid_key]['data']["tools_mill_ppname_g"] spindledir = self.app.options['tools_mill_spindledir'] @@ -3180,6 +3184,7 @@ class ToolMilling(AppTool, Excellon): feedrate=feedrate, feedrate_z=feedrate_z, feedrate_rapid=feedrate_rapid, spindlespeed=spindlespeed, spindledir=spindledir, dwell=dwell, dwelltime=dwelltime, laser_min_power=laser_min_power, + laser_on_code=laser_on_code, multidepth=multidepth, depthpercut=depthpercut, extracut=extracut, extracut_length=extracut_length, startz=startz, endz=endz, endxy=endxy, toolchange=toolchange, toolchangez=toolchangez, toolchangexy=toolchangexy, @@ -3237,10 +3242,10 @@ class ToolMilling(AppTool, Excellon): new_cncjob_obj.multigeo = True new_cncjob_obj.tools.clear() - new_cncjob_obj.segx = segx - new_cncjob_obj.segy = segy + new_cncjob_obj.seg_x = seg_x + new_cncjob_obj.seg_y = seg_y - new_cncjob_obj.z_pdepth = float(geo_obj.obj_options["tools_mill_z_pdepth"]) + new_cncjob_obj.z_p_depth = float(geo_obj.obj_options["tools_mill_z_p_depth"]) new_cncjob_obj.feedrate_probe = float(geo_obj.obj_options["tools_mill_feedrate_probe"]) # make sure that trying to make a CNCJob from an empty file is not creating an app crash @@ -3371,9 +3376,9 @@ class ToolMilling(AppTool, Excellon): # Probe Z try: if not from_tcl: - tools_dict[tooluid_key]['data']['tools_mill_z_pdepth'] = self.ui.pdepth_entry.get_value() + tools_dict[tooluid_key]['data']['tools_mill_z_p_depth'] = self.ui.pdepth_entry.get_value() except AttributeError: - tools_dict[tooluid_key]['data']['tools_mill_z_pdepth'] = self.app.options['tools_mill_z_pdepth'] + tools_dict[tooluid_key]['data']['tools_mill_z_p_depth'] = self.app.options['tools_mill_z_p_depth'] # Probe FR try: if not from_tcl: @@ -3609,6 +3614,9 @@ class ToolMilling(AppTool, Excellon): self.ui.las_min_pwr_label.show() self.ui.las_min_pwr_entry.show() + + self.ui.laser_turn_on_lbl.show() + self.ui.laser_turn_on_combo.show() else: self.ui.cutzlabel.show() self.ui.cutz_entry.show() @@ -3648,6 +3656,9 @@ class ToolMilling(AppTool, Excellon): self.ui.las_min_pwr_label.hide() self.ui.las_min_pwr_entry.hide() + self.ui.laser_turn_on_lbl.hide() + self.ui.laser_turn_on_combo.hide() + # if in Advanced Mode if self.ui.level.isChecked(): self.ui.dwell_cb.show() @@ -4741,14 +4752,29 @@ class MillingUI: 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.set_step(1) 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) + param_grid.addWidget(self.las_min_pwr_label, 46, 0) + param_grid.addWidget(self.las_min_pwr_entry, 46, 1) self.las_min_pwr_label.hide() self.las_min_pwr_entry.hide() + # Laser Turn ON Code + self.laser_turn_on_lbl = FCLabel('%s:' % _('Turn ON Code')) + self.laser_turn_on_lbl.setToolTip( + _("The Gode that will be executed to turn the laser on.") + ) + + self.laser_turn_on_combo = FCComboBox() + self.laser_turn_on_combo.addItems(["M3", "M4"]) + self.laser_turn_on_combo.setObjectName("mill_laser_turn_on") + + param_grid.addWidget(self.laser_turn_on_lbl, 48, 0) + param_grid.addWidget(self.laser_turn_on_combo, 48, 1) + self.laser_turn_on_lbl.hide() + self.laser_turn_on_combo.hide() + # Dwell self.dwell_cb = FCCheckBox('%s:' % _('Dwell')) self.dwell_cb.setToolTip( @@ -4767,8 +4793,8 @@ class MillingUI: ) self.dwelltime_entry.setObjectName("mill_dwelltime") - param_grid.addWidget(self.dwell_cb, 46, 0) - param_grid.addWidget(self.dwelltime_entry, 46, 1) + param_grid.addWidget(self.dwell_cb, 50, 0) + param_grid.addWidget(self.dwelltime_entry, 50, 1) self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) @@ -4929,41 +4955,41 @@ class MillingUI: gen_grid.addWidget(self.allow_level_cb, 14, 0, 1, 2) # Size of trace segment on X axis - segx_label = FCLabel('%s:' % _("Segment X size")) - segx_label.setToolTip( + seg_x_label = FCLabel('%s:' % _("Segment X size")) + seg_x_label.setToolTip( _("The size of the trace segment on the X axis.\n" "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the X axis.") ) - self.segx_entry = FCDoubleSpinner() - self.segx_entry.set_range(0, 99999) - self.segx_entry.set_precision(self.decimals) - self.segx_entry.setSingleStep(0.1) - self.segx_entry.setWrapping(True) - self.segx_entry.setObjectName("mill_segx") + self.seg_x_entry = FCDoubleSpinner() + self.seg_x_entry.set_range(0, 99999) + self.seg_x_entry.set_precision(self.decimals) + self.seg_x_entry.setSingleStep(0.1) + self.seg_x_entry.setWrapping(True) + self.seg_x_entry.setObjectName("mill_seg_x") - gen_grid.addWidget(segx_label, 16, 0) - gen_grid.addWidget(self.segx_entry, 16, 1) + gen_grid.addWidget(seg_x_label, 16, 0) + gen_grid.addWidget(self.seg_x_entry, 16, 1) # Size of trace segment on Y axis - segy_label = FCLabel('%s:' % _("Segment Y size")) - segy_label.setToolTip( + seg_y_label = FCLabel('%s:' % _("Segment Y size")) + seg_y_label.setToolTip( _("The size of the trace segment on the Y axis.\n" "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the Y axis.") ) - self.segy_entry = FCDoubleSpinner() - self.segy_entry.set_range(0, 99999) - self.segy_entry.set_precision(self.decimals) - self.segy_entry.setSingleStep(0.1) - self.segy_entry.setWrapping(True) - self.segy_entry.setObjectName("mill_segy") + self.seg_y_entry = FCDoubleSpinner() + self.seg_y_entry.set_range(0, 99999) + self.seg_y_entry.set_precision(self.decimals) + self.seg_y_entry.setSingleStep(0.1) + self.seg_y_entry.setWrapping(True) + self.seg_y_entry.setObjectName("mill_seg_y") - gen_grid.addWidget(segy_label, 18, 0) - gen_grid.addWidget(self.segy_entry, 18, 1) + gen_grid.addWidget(seg_y_label, 18, 0) + gen_grid.addWidget(self.seg_y_entry, 18, 1) self.oih = OptionalHideInputSection(self.allow_level_cb, - [segx_label, self.segx_entry, segy_label, self.segy_entry]) + [seg_x_label, self.seg_x_entry, seg_y_label, self.seg_y_entry]) # ------------------------------------------------------------------------------------------------------------ # ------------------------- EXCLUSION AREAS ------------------------------------------------------------------ diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index e866399d..c67a20b7 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -1063,7 +1063,7 @@ class SolderPaste(AppTool): # ## CREATE GCODE # ## is_first = True if tooluid_key == list(new_obj.tools.keys())[0] else False - res = new_obj.generate_gcode_from_solderpaste_geo(is_first=is_first, **tooluid_value) + res = new_obj.generate_gcode_from_solder_paste_geo(is_first=is_first, **tooluid_value) if res == 'fail': app_obj.log.debug("SolderPaste.on_create_gcode() --> generate_gcode_from_solderpaste_geo() failed") diff --git a/camlib.py b/camlib.py index 6285cde2..ad4be074 100644 --- a/camlib.py +++ b/camlib.py @@ -2745,12 +2745,12 @@ class CNCjob(Geometry): z_cut=-0.002, z_move=0.1, feedrate=3.0, feedrate_z=3.0, feedrate_rapid=3.0, feedrate_probe=3.0, pp_geometry_name='default', pp_excellon_name='default', - depthpercut=0.1, z_pdepth=-0.02, + depthpercut=0.1, z_p_depth=-0.02, spindlespeed=None, spindledir='CW', dwell=True, dwelltime=1000, toolchangez=0.787402, toolchange_xy='0.0,0.0', endz=2.0, endxy='', - segx=None, - segy=None, + seg_x=None, + seg_y=None, steps_per_circle=None): self.decimals = self.app.decimals @@ -2820,7 +2820,7 @@ class CNCjob(Geometry): self.f_retract = None # how much depth the probe can probe before error - self.z_pdepth = z_pdepth if z_pdepth else None + self.z_p_depth = z_p_depth if z_p_depth else None # the feedrate(speed) with which the probel travel while probing self.feedrate_probe = feedrate_probe if feedrate_probe else None @@ -2830,10 +2830,11 @@ class CNCjob(Geometry): self.dwell = dwell self.dwelltime = dwelltime self.laser_min_power = 0.0 + self.laser_on_code = "M03" # For Autolevelling - self.segx = float(segx) if segx is not None else 0.0 - self.segy = float(segy) if segy is not None else 0.0 + self.seg_x = float(seg_x) if seg_x is not None else 0.0 + self.seg_y = float(seg_y) if seg_y is not None else 0.0 # tells if the generated Gcode is segmented for autolevelling self.is_segmented_gcode = False @@ -3316,7 +3317,7 @@ class CNCjob(Geometry): # detect if GCode is segmented for autolevelling or not # it does not matter for the Excellon codes because we are not going to autolevel GCode out of Excellon # but it is here for uniformity between the Geometry and Excellon objects - if self.segx > 0 and self.segy > 0 and self.is_segmented_gcode is False: + if self.seg_x > 0 and self.seg_y > 0 and self.is_segmented_gcode is False: self.is_segmented_gcode = True self.exc_tools = deepcopy(tools) @@ -3387,6 +3388,7 @@ class CNCjob(Geometry): self.spindledir = tool_dict['tools_drill_spindledir'] self.laser_min_power = tool_dict['tools_drill_min_power'] + self.laser_on_code = tool_dict['tools_drill_laser_on'] self.tooldia = tools[tool]["tooldia"] self.postdata['toolC'] = tools[tool]["tooldia"] @@ -3441,7 +3443,7 @@ class CNCjob(Geometry): self.xy_end = [0, 0] # Probe parameters - self.z_pdepth = tool_dict["tools_drill_z_pdepth"] + self.z_p_depth = tool_dict["tools_drill_z_p_depth"] self.feedrate_probe = tool_dict["tools_drill_feedrate_probe"] # ######################################################################################################### # ######################################################################################################### @@ -3536,7 +3538,7 @@ class CNCjob(Geometry): self.coordinates_type = self.app.options["cncjob_coords_type"] if self.coordinates_type == "G90": - # Drillling! for Absolute coordinates type G90 + # Drilling! for Absolute coordinates type G90 # variables to display the percentage of work done geo_len = len(optimized_path) @@ -3859,6 +3861,8 @@ class CNCjob(Geometry): except KeyError: self.laser_min_power = 0.0 + self.laser_on_code = tool_dict['tools_mill_laser_on'] + try: self.spindlespeed = float(tool_dict['tools_mill_spindlespeed']) except TypeError: @@ -3926,7 +3930,7 @@ class CNCjob(Geometry): self.extracut_length = tool_dict['tools_mill_extracut_length'] # Probe parameters - # self.z_pdepth = tool_dict["tools_drill_z_pdepth"] + # self.z_p_depth = tool_dict["tools_drill_z_p_depth"] # self.feedrate_probe = tool_dict["tools_drill_feedrate_probe"] # ######################################################################################################### @@ -5225,7 +5229,9 @@ class CNCjob(Geometry): def generate_from_geometry_2(self, geo_obj, append=True, tooldia=None, offset=0.0, tolerance=0, z_cut=None, z_move=None, feedrate=None, feedrate_z=None, feedrate_rapid=None, spindlespeed=None, - spindledir='CW', dwell=False, dwelltime=None, laser_min_power=0.0, + spindledir='CW', dwell=False, dwelltime=None, + laser_min_power=0.0, + laser_on_code="M03", multidepth=False, depthpercut=None, toolchange=False, toolchangez=None, toolchangexy="0.0, 0.0", extracut=False, extracut_length=None, startz=None, endz=None, endxy='', pp_geometry_name=None, @@ -5394,6 +5400,7 @@ class CNCjob(Geometry): self.dwelltime = float(dwelltime) if dwelltime is not None else self.app.options["tools_mill_dwelltime"] self.laser_min_power = int(laser_min_power) + self.laser_on_code = str(laser_on_code) self.startz = float(startz) if startz is not None and startz != '' else self.app.options["tools_mill_startz"] @@ -5672,7 +5679,7 @@ class CNCjob(Geometry): return self.gcode, start_gcode - def generate_gcode_from_solderpaste_geo(self, is_first=False, **kwargs): + def generate_gcode_from_solder_paste_geo(self, is_first=False, **kwargs): """ Algorithm to generate from multitool Geometry. @@ -6662,7 +6669,7 @@ class CNCjob(Geometry): if len(coords) < 2: return list(coords) - if self.segx <= 0 and self.segy <= 0: + if self.seg_x <= 0 and self.seg_y <= 0: return list(coords) # flag that the generated gcode was segmented for autolevelling @@ -6695,11 +6702,11 @@ class CNCjob(Geometry): # recursively breaks down a given line until it is within the # required step size def linebreak(line): - pt_new = linebreak_single(line, 0, self.segx) + pt_new = linebreak_single(line, 0, self.seg_x) if pt_new is None: - pt_new2 = linebreak_single(line, 1, self.segy) + pt_new2 = linebreak_single(line, 1, self.seg_y) else: - pt_new2 = linebreak_single((line[0], pt_new), 1, self.segy) + pt_new2 = linebreak_single((line[0], pt_new), 1, self.seg_y) if pt_new2 is not None: pt_new = pt_new2[::-1] diff --git a/defaults.py b/defaults.py index cb585b2a..d0846d33 100644 --- a/defaults.py +++ b/defaults.py @@ -310,8 +310,8 @@ class AppDefaults: "geometry_plot_line": "#FF0000", # Geometry Options - "geometry_segx": 0.0, - "geometry_segy": 0.0, + "geometry_seg_x": 0.0, + "geometry_seg_y": 0.0, # Geometry Export "geometry_dxf_format": 'R2010', @@ -409,7 +409,10 @@ class AppDefaults: "tools_drill_spindlespeed": 0, "tools_drill_dwell": False, "tools_drill_dwelltime": 1, - "tools_drill_min_power": 0.0, + # Laser parameters + "tools_drill_min_power": 0.0, + "tools_drill_laser_on": "M3", + "tools_drill_toolchange": False, "tools_drill_toolchangez": 15, "tools_drill_preprocessor_list": ['default'], @@ -424,7 +427,7 @@ class AppDefaults: "tools_drill_toolchangexy": "0.0, 0.0", "tools_drill_startz": None, "tools_drill_feedrate_rapid": 1500, - "tools_drill_z_pdepth": -0.02, + "tools_drill_z_p_depth": -0.02, "tools_drill_feedrate_probe": 75, "tools_drill_spindledir": 'CW', "tools_drill_f_plunge": False, @@ -456,7 +459,10 @@ class AppDefaults: "tools_mill_feedrate": 120, "tools_mill_feedrate_z": 60, + # Laser parameters "tools_mill_min_power": 0.0, + "tools_mill_laser_on": "M3", + "tools_mill_spindlespeed": 0, "tools_mill_dwell": False, "tools_mill_dwelltime": 1, @@ -469,7 +475,7 @@ class AppDefaults: "tools_mill_feedrate_rapid": 1500, "tools_mill_extracut": False, "tools_mill_extracut_length": 0.1, - "tools_mill_z_pdepth": -0.02, + "tools_mill_z_p_depth": -0.02, "tools_mill_feedrate_probe": 75, "tools_mill_f_plunge": False, "tools_mill_spindledir": 'CW', diff --git a/locale/de/LC_MESSAGES/strings.po b/locale/de/LC_MESSAGES/strings.po index c0a48fd1..81edb171 100644 --- a/locale/de/LC_MESSAGES/strings.po +++ b/locale/de/LC_MESSAGES/strings.po @@ -25138,11 +25138,11 @@ msgstr "" #~ msgstr "Import der FlatCAM-Werkzeugdatenbank abgebrochen." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Falsches Wertformat für self.defaults [\"z_pdepth\"] oder self.options " -#~ "[\"z_pdepth\"]" +#~ "Falsches Wertformat für self.defaults [\"z_p_depth\"] oder self.options " +#~ "[\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/en/LC_MESSAGES/strings.po b/locale/en/LC_MESSAGES/strings.po index 20bef454..05b1141d 100644 --- a/locale/en/LC_MESSAGES/strings.po +++ b/locale/en/LC_MESSAGES/strings.po @@ -23945,11 +23945,11 @@ msgstr "No Geometry name in args. Provide a name and try again." #~ msgstr "FlatCAM Tools DB import cancelled." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/es/LC_MESSAGES/strings.po b/locale/es/LC_MESSAGES/strings.po index 58c4c38d..612899c4 100644 --- a/locale/es/LC_MESSAGES/strings.po +++ b/locale/es/LC_MESSAGES/strings.po @@ -24532,11 +24532,11 @@ msgstr "" #~ msgstr "Se ha cancelado la importación de DB de herramientas FlatCAM." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Formato de valor incorrecto para self.defaults [\"z_pdepth\"] o self." -#~ "options [\"z_pdepth\"]" +#~ "Formato de valor incorrecto para self.defaults [\"z_p_depth\"] o self." +#~ "options [\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/fr/LC_MESSAGES/strings.po b/locale/fr/LC_MESSAGES/strings.po index c525d594..9fe9d807 100644 --- a/locale/fr/LC_MESSAGES/strings.po +++ b/locale/fr/LC_MESSAGES/strings.po @@ -25095,11 +25095,11 @@ msgstr "" #~ msgstr "Importation de la BD des outils FlatCAM annulée." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Format de valeur incorrect pour self.defaults [\"z_pdepth\"] ou self." -#~ "options [\"z_pdepth\"]" +#~ "Format de valeur incorrect pour self.defaults [\"z_p_depth\"] ou self." +#~ "options [\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/it/LC_MESSAGES/strings.po b/locale/it/LC_MESSAGES/strings.po index 3350867d..33c04ea7 100644 --- a/locale/it/LC_MESSAGES/strings.po +++ b/locale/it/LC_MESSAGES/strings.po @@ -24283,11 +24283,11 @@ msgstr "Nessun nome di geometria negli argomenti. Fornisci un nome e riprova." #~ msgstr "Importazione DB utensili FlatCAM annullata." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Formato valori errato per self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Formato valori errato per self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/pt_BR/LC_MESSAGES/strings.po b/locale/pt_BR/LC_MESSAGES/strings.po index 9211c8b9..3e96e734 100644 --- a/locale/pt_BR/LC_MESSAGES/strings.po +++ b/locale/pt_BR/LC_MESSAGES/strings.po @@ -23145,9 +23145,9 @@ msgstr "Nenhum nome de geometria nos argumentos. Altere e tente novamente." #~ msgid "FlatCAM Tools DB import cancelled." #~ msgstr "Importação de BD do FlatCAM cancelada." -#~ msgid "Wrong value format for self.defaults[\"z_pdepth\"] or self.options[\"z_pdepth\"]" +#~ msgid "Wrong value format for self.defaults[\"z_p_depth\"] or self.options[\"z_p_depth\"]" #~ msgstr "" -#~ "Valor com formato incorreto para self.defaults[\"z_pdepth\"] ou self.options[\"z_pdepth" +#~ "Valor com formato incorreto para self.defaults[\"z_p_depth\"] ou self.options[\"z_p_depth" #~ "\"]" #~ msgid "" diff --git a/locale/ro/LC_MESSAGES/strings.po b/locale/ro/LC_MESSAGES/strings.po index 2b561cb1..ebceca7f 100644 --- a/locale/ro/LC_MESSAGES/strings.po +++ b/locale/ro/LC_MESSAGES/strings.po @@ -24362,10 +24362,10 @@ msgstr "" #~ msgstr "Importul DB Unelte a fost anulat." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Valoare gresita pt self.defaults[\"z_pdepth\"] sau self.options[\"z_pdepth" +#~ "Valoare gresita pt self.defaults[\"z_p_depth\"] sau self.options[\"z_p_depth" #~ "\"]" #~ msgid "" diff --git a/locale/ru/LC_MESSAGES/strings.po b/locale/ru/LC_MESSAGES/strings.po index d48ce854..66ff3dc6 100644 --- a/locale/ru/LC_MESSAGES/strings.po +++ b/locale/ru/LC_MESSAGES/strings.po @@ -25057,11 +25057,11 @@ msgstr "Нет имени геометрии в аргументах. Укажи #~ msgstr "Импорт FlatCAM БД отменен." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Неправильный формат значения для self.defaults[\"z_pdepth\"] или self." -#~ "options[\"z_pdepth\"]" +#~ "Неправильный формат значения для self.defaults[\"z_p_depth\"] или self." +#~ "options[\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/locale/tr/LC_MESSAGES/strings.po b/locale/tr/LC_MESSAGES/strings.po index 0f9d8038..2fe6171b 100644 --- a/locale/tr/LC_MESSAGES/strings.po +++ b/locale/tr/LC_MESSAGES/strings.po @@ -23960,11 +23960,11 @@ msgstr "Değişkenlerde Şekil ismi yok. Lütfen bir isim girin ve tekrar deneyi #~ msgstr "FlatCAM Tools DB import cancelled." #~ msgid "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgstr "" -#~ "Wrong value format for self.defaults[\"z_pdepth\"] or self." -#~ "options[\"z_pdepth\"]" +#~ "Wrong value format for self.defaults[\"z_p_depth\"] or self." +#~ "options[\"z_p_depth\"]" #~ msgid "" #~ "Wrong value format for self.defaults[\"feedrate_probe\"] or self." diff --git a/preprocessors/GRBL_laser.py b/preprocessors/GRBL_laser.py index 0b9801da..bd966e24 100644 --- a/preprocessors/GRBL_laser.py +++ b/preprocessors/GRBL_laser.py @@ -26,7 +26,7 @@ class GRBL_laser(PreProc): '(This preprocessor makes no moves on the Z axis it will only move horizontally.)\n' \ '(The horizontal move is done with G0 - highest possible speed set in the GRBL controller.)\n' \ '(It assumes a manually focused laser.)\n' \ - '(The laser is started with M3 command and stopped with the M5 command.)\n\n' + '(The laser is started with M3 or M4 command and stopped with the M5 command.)\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) xmax = '%.*f' % (p.coords_decimals, p['obj_options']['xmax']) @@ -60,15 +60,15 @@ class GRBL_laser(PreProc): def lift_code(self, p): if float(p.laser_min_power) > 0.0: # the formatted text: laser OFF must always be like this else the plotting will not be done correctly - return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power) + return '%s S%s (laser OFF)\n' % (str(p.laser_on_code), str(p.laser_min_power)) else: return 'M5' def down_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code) def toolchange_code(self, p): return '' @@ -115,9 +115,9 @@ class GRBL_laser(PreProc): def spindle_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code) def dwell_code(self, p): return '' diff --git a/preprocessors/GRBL_laser_z.py b/preprocessors/GRBL_laser_z.py index adb1b046..6fd6e383 100644 --- a/preprocessors/GRBL_laser_z.py +++ b/preprocessors/GRBL_laser_z.py @@ -80,15 +80,15 @@ class GRBL_laser_z(PreProc): def lift_code(self, p): if float(p.laser_min_power) > 0.0: # the formatted text: laser OFF must always be like this else the plotting will not be done correctly - return 'M3 S%s (laser OFF)\n' % str(p.laser_min_power) + return '%s S%s (laser OFF)\n' % (str(p.laser_on_code), str(p.laser_min_power)) else: return 'M5' def down_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code) def toolchange_code(self, p): return 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move) @@ -135,9 +135,9 @@ class GRBL_laser_z(PreProc): def spindle_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code) def dwell_code(self, p): return '' diff --git a/preprocessors/Marlin_laser_FAN_pin.py b/preprocessors/Marlin_laser_FAN_pin.py index 85929da6..eb073b80 100644 --- a/preprocessors/Marlin_laser_FAN_pin.py +++ b/preprocessors/Marlin_laser_FAN_pin.py @@ -23,7 +23,7 @@ class Marlin_laser_FAN_pin(PreProc): gcode += ';It is for the case when it is used together with a LASER connected on one of the FAN pins.\n'\ ';This preprocessor makes no moves on the Z axis it will only move horizontally.\n' \ ';It assumes a manually focused laser.\n' \ - ';The laser is started with M3 command and stopped with the M5 command.\n\n' + ';The laser is started and stopped with M106 command.\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) xmax = '%.*f' % (p.coords_decimals, p['obj_options']['xmax']) diff --git a/preprocessors/Marlin_laser_Spindle_pin.py b/preprocessors/Marlin_laser_Spindle_pin.py index 180e8200..192c3c03 100644 --- a/preprocessors/Marlin_laser_Spindle_pin.py +++ b/preprocessors/Marlin_laser_Spindle_pin.py @@ -23,7 +23,7 @@ class Marlin_laser_Spindle_pin(PreProc): gcode += ';It is for the case when it is used together with a LASER connected on the SPINDLE connector.\n'\ ';This preprocessor makes no moves on the Z axis it will only move horizontally.\n' \ ';It assumes a manually focused laser.\n' \ - ';The laser is started with M3 command and stopped with the M5 command.\n\n' + ';The laser is started with M3 or M4 command and stopped with the M5 command.\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) xmax = '%.*f' % (p.coords_decimals, p['obj_options']['xmax']) @@ -64,7 +64,7 @@ class Marlin_laser_Spindle_pin(PreProc): def lift_code(self, p): if float(p.laser_min_power) > 0.0: # the formatted text: laser OFF must always be like this else the plotting will not be done correctly - return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power) + return '%s S%s ;laser OFF\n' % (str(p.laser_on_code).replace("0", ""), str(p.laser_min_power)) else: gcode = 'M400\n' gcode += 'M5' @@ -72,9 +72,9 @@ class Marlin_laser_Spindle_pin(PreProc): def down_code(self, p): if p.spindlespeed: - return 'M3 S%s' % str(p.spindlespeed) + return '%s S%s' % (str(p.laser_on_code).replace("0", ""), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code) def toolchange_code(self, p): return '' @@ -125,11 +125,10 @@ class Marlin_laser_Spindle_pin(PreProc): return 'F' + self.feedrate_rapid_format % (p.fr_decimals, p.feedrate_rapid) def spindle_code(self, p): - sdir = {'CW': 'M3', 'CCW': 'M4'}[p.spindledir] if p.spindlespeed: - return '%s S%s' % (sdir, str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code).replace("0", ""), str(p.spindlespeed)) else: - return sdir + return str(p.laser_on_code).replace("0", "") def dwell_code(self, p): return '' diff --git a/preprocessors/Marlin_laser_z.py b/preprocessors/Marlin_laser_z.py index 1a4e9cb3..ea941c3a 100644 --- a/preprocessors/Marlin_laser_z.py +++ b/preprocessors/Marlin_laser_z.py @@ -22,6 +22,7 @@ class Marlin_laser_z(PreProc): end_coords_xy = p['xy_end'] gcode = ';This preprocessor is used with a motion controller loaded with MARLIN firmware.\n' gcode += ';It is for the case when it is used together with a LASER connected on the SPINDLE connector.\n' \ + ';The laser is started with M3 or M4 command and stopped with the M5 command.\n\n' \ ';On toolchange event the laser will move to a defined Z height to change the laser dot size.\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) @@ -100,7 +101,7 @@ class Marlin_laser_z(PreProc): def lift_code(self, p): if float(p.laser_min_power) > 0.0: # the formatted text: laser OFF must always be like this else the plotting will not be done correctly - return 'M3 S%s ;laser OFF\n' % str(p.laser_min_power) + return '%s S%s ;laser OFF\n' % (str(p.laser_on_code).replace("0", ""), str(p.laser_min_power)) else: gcode = 'M400\n' gcode += 'M5' @@ -108,9 +109,9 @@ class Marlin_laser_z(PreProc): def down_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code).replace("0", ""), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code).replace("0", "") def toolchange_code(self, p): return 'G0 Z' + self.coordinate_format % (p.coords_decimals, p.z_move) @@ -168,9 +169,9 @@ class Marlin_laser_z(PreProc): def spindle_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M3', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code).replace("0", ""), str(p.spindlespeed)) else: - return 'M3' + return str(p.laser_on_code).replace("0", "") def dwell_code(self, p): return '' diff --git a/preprocessors/Toolchange_Probe_MACH3.py b/preprocessors/Toolchange_Probe_MACH3.py index ad036fe5..473a075a 100644 --- a/preprocessors/Toolchange_Probe_MACH3.py +++ b/preprocessors/Toolchange_Probe_MACH3.py @@ -152,11 +152,11 @@ G00 X{x_toolchange} Y{y_toolchange} (MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE ||| Drills for this tool = {t_drills}) M0 F{feedrate_probe} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_in_between} F{feedrate_probe_slow} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_move} (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...) @@ -168,7 +168,7 @@ M0 z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2), feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)), feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))), - z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth), + z_p_depth=self.coordinate_format % (p.coords_decimals, p.z_p_depth), tool=int(p.tool), t_drills=no_drills, toolC=toolC_formatted) @@ -181,11 +181,11 @@ G00 Z{z_toolchange} (MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE ||| Drills for this tool = {t_drills}) M0 F{feedrate_probe} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_in_between} F{feedrate_probe_slow} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_move} (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...) @@ -195,7 +195,7 @@ M0 z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2), feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)), feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))), - z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth), + z_p_depth=self.coordinate_format % (p.coords_decimals, p.z_p_depth), tool=int(p.tool), t_drills=no_drills, toolC=toolC_formatted) @@ -215,11 +215,11 @@ G00 X{x_toolchange} Y{y_toolchange} (MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE) M0 F{feedrate_probe} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_in_between} F{feedrate_probe_slow} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_move} (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...) @@ -231,7 +231,7 @@ M0 z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2), feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)), feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))), - z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth), + z_p_depth=self.coordinate_format % (p.coords_decimals, p.z_p_depth), tool=int(p.tool), toolC=toolC_formatted) else: @@ -243,11 +243,11 @@ G00 Z{z_toolchange} (MSG, Change to Tool Dia = {toolC} ||| CONNECT THE PROBE) M0 F{feedrate_probe} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_in_between} F{feedrate_probe_slow} -G31 Z{z_pdepth} +G31 Z{z_p_depth} G92 Z0 G00 Z{z_move} (MSG, Remove any clips or other devices used for probing. CNC work is resuming ...) @@ -257,7 +257,7 @@ M0 z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2), feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)), feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))), - z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth), + z_p_depth=self.coordinate_format % (p.coords_decimals, p.z_p_depth), tool=int(p.tool), toolC=toolC_formatted) diff --git a/preprocessors/default_laser.py b/preprocessors/default_laser.py index a89676e7..b2cdb611 100644 --- a/preprocessors/default_laser.py +++ b/preprocessors/default_laser.py @@ -24,7 +24,7 @@ class default_laser(PreProc): '(This preprocessor makes no moves on the Z axis it will only move horizontally.)\n' \ '(The horizontal move is done with G0 - highest possible speed set in MACH3.)\n' \ '(It assumes a manually focused laser.)\n' \ - '(The laser is started with M3 command and stopped with the M5 command.)\n\n' + '(The laser is started with M3 or M4 command and stopped with the M5 command.)\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) xmax = '%.*f' % (p.coords_decimals, p['obj_options']['xmax']) @@ -57,15 +57,15 @@ class default_laser(PreProc): def lift_code(self, p): if float(p.laser_min_power) > 0.0: # the formatted text: laser OFF must always be like this else the plotting will not be done correctly - return 'M03 S%s (laser OFF)\n' % str(p.laser_min_power) + return '%s S%s (laser OFF)\n' % (str(p.laser_on_code), str(p.laser_min_power)) else: return 'M05' def down_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M03', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M03' + return str(p.laser_on_code) def toolchange_code(self, p): return '' @@ -120,9 +120,9 @@ class default_laser(PreProc): def spindle_code(self, p): if p.spindlespeed: - return '%s S%s' % ('M03', str(p.spindlespeed)) + return '%s S%s' % (str(p.laser_on_code), str(p.spindlespeed)) else: - return 'M03' + return str(p.laser_on_code) def dwell_code(self, p): return '' diff --git a/preprocessors/grbl_laser_eleks_drd.py b/preprocessors/grbl_laser_eleks_drd.py index 6e355571..29553d42 100644 --- a/preprocessors/grbl_laser_eleks_drd.py +++ b/preprocessors/grbl_laser_eleks_drd.py @@ -30,6 +30,7 @@ class grbl_laser_eleks_drd(PreProc): gcode += '(which helps for centering the drill bit for manual drilling)\n' gcode += '(The GRBL Controller has to support G2 commands)\n' gcode += '(The moves are only on horizontal plane X-Y. There are no Z moves.)\n' + gcode += '(The moves are only on horizontal plane X-Y. There are no Z moves.)\n' gcode += '(Assumes manual laser focussing.)\n\n' xmin = '%.*f' % (p.coords_decimals, p['obj_options']['xmin']) @@ -55,10 +56,7 @@ class grbl_laser_eleks_drd(PreProc): # gcode += 'G94;Feedrate per minute\n' gcode += 'G00 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate_rapid)) + '\n' gcode += 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate)) + '\n' # Is Z-Feedrate for Excellon - if p.spindledir == 'CCW': - gcode += 'M04' - else: - gcode += 'M03' + gcode += p.laser_on_code if p.spindlespeed: gcode += ' ' + 'S%d' % p.spindlespeed gcode += ';' + p.spindledir @@ -71,10 +69,7 @@ class grbl_laser_eleks_drd(PreProc): return 'M05;lift' def down_code(self, p): - if p.spindledir == 'CCW': - gcode = 'M04' - else: - gcode = 'M03' + gcode = p.laser_on_code gcode += ';down' if str(p['obj_options']['type']) == 'Excellon' or str(p['obj_options']['type']) == 'Excellon Geometry': gcode += '\n' diff --git a/tclCommands/TclCommandCncjob.py b/tclCommands/TclCommandCncjob.py index 71bdbf9c..faf595bd 100644 --- a/tclCommands/TclCommandCncjob.py +++ b/tclCommands/TclCommandCncjob.py @@ -256,8 +256,8 @@ class TclCommandCncjob(TclCommandSignaled): for tool_uid in list(local_tools_dict.keys()): if 'data' in local_tools_dict[tool_uid]: - local_tools_dict[tool_uid]['data']['segx'] = self.app.options['geometry_segx'] - local_tools_dict[tool_uid]['data']['segy'] = self.app.options['geometry_segx'] + local_tools_dict[tool_uid]['data']['seg_x'] = self.app.options['geometry_seg_x'] + local_tools_dict[tool_uid]['data']['seg_y'] = self.app.options['geometry_seg_x'] local_tools_dict[tool_uid]['data']['tools_mill_tooldia'] = args["dia"] local_tools_dict[tool_uid]['data']['tools_mill_cutz'] = args["z_cut"] local_tools_dict[tool_uid]['data']['tools_mill_travelz'] = args["z_move"] @@ -285,7 +285,7 @@ class TclCommandCncjob(TclCommandSignaled): local_tools_dict[tool_uid]['data']['tools_mill_min_power'] = args['las_min_pwr'] local_tools_dict[tool_uid]['data']['tools_mill_ppname_g'] = args["pp"] - self.app.milling_tool.mtool_gen_cncjob( + self.app.milling_tool.generate_cnc_job_handler( geo_obj=obj, outname=args['outname'], tools_dict=local_tools_dict, diff --git a/tclCommands/TclCommandCopperClear.py b/tclCommands/TclCommandCopperClear.py index 5f2f3481..e34c1cfc 100644 --- a/tclCommands/TclCommandCopperClear.py +++ b/tclCommands/TclCommandCopperClear.py @@ -202,8 +202,8 @@ class TclCommandCopperClear(TclCommand): "tools_ncc_contour": contour, "tools_ncc_overlap": overlap, - "segx": self.app.options["geometry_segx"], - "segy": self.app.options["geometry_segy"] + "seg_x": self.app.options["geometry_seg_x"], + "seg_y": self.app.options["geometry_seg_y"] }) ncc_tools = {} diff --git a/tclCommands/TclCommandPaint.py b/tclCommands/TclCommandPaint.py index 808b985d..61ca7dd2 100644 --- a/tclCommands/TclCommandPaint.py +++ b/tclCommands/TclCommandPaint.py @@ -190,8 +190,8 @@ class TclCommandPaint(TclCommand): "tools_paint_connect": connect, "tools_paint_contour": contour, "tools_paint_overlap": overlap, - "segx": self.app.options["geometry_segx"], - "segy": self.app.options["geometry_segy"] + "seg_x": self.app.options["geometry_seg_x"], + "seg_y": self.app.options["geometry_seg_y"] }) # create a `tools` dict