From 33897e8e837cffeb1fe4ae39afb26ec75f934870 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 31 Jan 2022 00:29:59 +0200 Subject: [PATCH] - fixed a minor UI glitch in the CNCJob UI - made sure that the `drillcncjob` and `cncjob` Tcl commands will use the `-las_power` parameter to set the laser power when using a preprocessor with `laser` in its name --- CHANGELOG.md | 2 ++ appObjects/FlatCAMCNCJob.py | 1 + app_Main.py | 4 ++-- defaults.py | 5 +++-- tclCommands/TclCommandCncjob.py | 10 ++++++++-- tclCommands/TclCommandDrillcncjob.py | 20 ++++++++++++++------ 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e8efc62..f4a033aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ CHANGELOG for FlatCAM beta - fixed all the `laser` preprocessors to work correctly and the resulting GCode to be plotted - made sure that when drilling and milling with a `laser` preprocessor the first move is not done with the laser on +- fixed a minor UI glitch in the CNCJob UI +- made sure that the `drillcncjob` and `cncjob` Tcl commands will use the `-las_power` parameter to set the laser power when using a preprocessor with `laser` in its name 30.01.2022 diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index 8ecd9a76..2b3e355b 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -305,6 +305,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): horizontal_header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(0, 20) horizontal_header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeMode.Stretch) + horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeMode.ResizeToContents) horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeMode.Fixed) horizontal_header.resizeSection(4, 40) diff --git a/app_Main.py b/app_Main.py index bbabc341..26899f64 100644 --- a/app_Main.py +++ b/app_Main.py @@ -651,7 +651,7 @@ class App(QtCore.QObject): # those need to be duplicated in self.defaults["util_autocomplete_keywords"] but within a string self.default_keywords = ['Berta_CNC', 'Default_no_M6', 'Desktop', 'Documents', 'FlatConfig', 'FlatPrj', 'False', 'GRBL_11', 'GRL_11_no_M6', 'GRBL_laser', 'grbl_laser_eleks_drd', - 'GRBL_laser_Z', 'ISEL_CNC', 'ISEL_ICP_CNC', + 'GRBL_laser_z', 'ISEL_CNC', 'ISEL_ICP_CNC', 'Line_xyz', 'Marlin', 'Marlin_laser_FAN_pin', 'Marlin_laser_Spindle_pin', 'NCCAD9', 'Marius', 'My Documents', 'Paste_1', 'Repetier', 'Roland_MDX_20', 'Roland_MDX_540', @@ -664,7 +664,7 @@ class App(QtCore.QObject): 'dwelltime', 'extracut_length', 'endxy', 'endz', 'f', 'factor', 'feedrate', 'feedrate_z', 'gridoffsety', 'gridx', 'gridy', 'has_offset', 'holes', 'hpgl', 'iso_type', 'join', 'keep_scripts', - 'margin', 'marlin', 'method', + 'las_min_pwr', 'las_power', 'margin', 'marlin', 'method', 'milled_dias', 'minoffset', 'name', 'offset', 'opt_type', 'order', 'outname', 'overlap', 'obj_name', 'passes', 'postamble', 'pp', 'ppname_e', 'ppname_g', 'preamble', 'radius', 'ref', 'rest', 'rows', 'shellvar_', 'scale_factor', diff --git a/defaults.py b/defaults.py index c6dcf1ba..34d8081e 100644 --- a/defaults.py +++ b/defaults.py @@ -793,7 +793,7 @@ class FlatCAMDefaults: 'mil, outline, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm', # Keyword list "util_autocomplete_keywords": 'Berta_CNC, Default_no_M6, Desktop, Documents, FlatConfig, FlatPrj, False, ' - 'GRBL_11, GRL_11_no_M6, GRBL_laser, grbl_laser_eleks_drd, GRBL_laser_Z, ' + 'GRBL_11, GRL_11_no_M6, GRBL_laser, grbl_laser_eleks_drd, GRBL_laser_z, ' 'ISEL_CNC, ISEL_ICP_CNC, ' 'Line_xyz, Marlin, Marlin_laser_FAN_pin, ' 'Marlin_laser_Spindle_pin, NCCAD9, ' @@ -805,7 +805,8 @@ class FlatCAMDefaults: 'depthperpass, dia, diatol, dist, drilled_dias, drillz, dpp, dwelltime, ' 'endxy, endz, extracut_length, f, factor, feedrate, ' 'feedrate_z, gridoffsety, gridx, gridy, has_offset, ' - 'holes, hpgl, iso_type, join, keep_scripts, margin, marlin, method, milled_dias, ' + 'holes, hpgl, iso_type, join, ' + 'las_min_pwr, las_power, keep_scripts, margin, marlin, method, milled_dias, ' 'minoffset, name, offset, opt_type, order, outname, overlap, obj_name' 'passes, postamble, pp, ppname_e, ppname_g, preamble, radius, ref, rest, ' 'rows, shellvar_, scale_factor, spacing_columns, spacing_rows, spindlespeed, ' diff --git a/tclCommands/TclCommandCncjob.py b/tclCommands/TclCommandCncjob.py index 03b649db..e93e4efe 100644 --- a/tclCommands/TclCommandCncjob.py +++ b/tclCommands/TclCommandCncjob.py @@ -43,6 +43,7 @@ class TclCommandCncjob(TclCommandSignaled): ('endxy', str), ('spindlespeed', int), ('dwelltime', float), + ('las_power', float), ('las_min_pwr', float), ('pp', str), ('muted', str), @@ -77,7 +78,8 @@ class TclCommandCncjob(TclCommandSignaled): ('dwelltime', 'Time to pause to allow the spindle to reach the full speed.\n' 'If it is not used in command then it will not be included'), ('outname', 'Name of the resulting Geometry object.'), - ('las_min_pwr', 'Used with "laser" preprocessors. States the laser power when not cutting'), + ('las_power', 'Used with "laser" preprocessors. Set the laser power when cutting'), + ('las_min_pwr', 'Used with "laser" preprocessors. Set the laser power when not cutting, travelling'), ('pp', 'Name of the Geometry preprocessor. No quotes, case sensitive'), ('muted', 'It will not put errors in the Shell. Can be True (1) or False (0)') ]), @@ -187,7 +189,11 @@ class TclCommandCncjob(TclCommandSignaled): "in format (x, y) - no spaces allowed. But always two comma separated values.") # Spindle speed - args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args and args["spindlespeed"] != 0 else None + if 'laser' not in args["pp"]: + args["spindlespeed"] = (args["spindlespeed"] if "spindlespeed" in args and + args["spindlespeed"] != 0 else None) + else: + args["spindlespeed"] = args["las_power"] if "las_power" in args else 0.0 # Laser minimum power args["las_min_pwr"] = args["las_min_pwr"] if "las_min_pwr" in args else 0.0 diff --git a/tclCommands/TclCommandDrillcncjob.py b/tclCommands/TclCommandDrillcncjob.py index a5bc70ec..9e36d361 100644 --- a/tclCommands/TclCommandDrillcncjob.py +++ b/tclCommands/TclCommandDrillcncjob.py @@ -42,6 +42,7 @@ class TclCommandDrillcncjob(TclCommandSignaled): ('endz', float), ('endxy', str), ('dwelltime', float), + ('las_power', float), ('las_min_pwr', float), ('pp', str), ('opt_type', str), @@ -77,7 +78,8 @@ class TclCommandDrillcncjob(TclCommandSignaled): 'like: 0.3,1.0). WARNING: no spaces allowed in the value.'), ('dwelltime', 'Time to pause to allow the spindle to reach the full speed.\n' 'If it is not used in command then it will not be included'), - ('las_min_pwr', 'Used with "laser" preprocessors. States the laser power when not cutting'), + ('las_power', 'Used with "laser" preprocessors. Set the laser power when cutting'), + ('las_min_pwr', 'Used with "laser" preprocessors. Set the laser power when not cutting, travelling'), ('pp', 'This is the Excellon preprocessor name: case_sensitive, no_quotes'), ('opt_type', 'Name of move optimization type. B by default for Basic OR-Tools, M for Metaheuristic OR-Tools' 'T from Travelling Salesman Algorithm. B and M works only for 64bit version of FlatCAM and ' @@ -287,6 +289,7 @@ class TclCommandDrillcncjob(TclCommandSignaled): pp_excellon_name = args["pp"] if "pp" in args and args["pp"] else self.app.defaults["tools_drill_ppname_e"] job_obj.pp_excellon_name = pp_excellon_name job_obj.options['ppname_e'] = pp_excellon_name + # multidepth if 'dpp' in args: job_obj.multidepth = True @@ -308,8 +311,16 @@ class TclCommandDrillcncjob(TclCommandSignaled): job_obj.feedrate_rapid = float(args["feedrate_rapid"]) \ if "feedrate_rapid" in args and args["feedrate_rapid"] else \ self.app.defaults["tools_drill_feedrate_rapid"] - # SpindleSpped - job_obj.spindlespeed = float(args["spindlespeed"]) if "spindlespeed" in args else None + + # SpindleSpped / Laser Power + if 'laser' not in pp_excellon_name: + job_obj.spindlespeed = float(args["spindlespeed"]) if "spindlespeed" in args else None + else: + job_obj.spindlespeed = float(args["las_power"]) if "las_power" in args else 0.0 + + # laser minimum power + job_obj.laser_min_power = float(args["las_min_pwr"]) if "las_min_pwr" in args else 0.0 + # spindle direction job_obj.spindledir = self.app.defaults["tools_drill_spindledir"] # dwell and dwelltime @@ -323,9 +334,6 @@ class TclCommandDrillcncjob(TclCommandSignaled): job_obj.dwell = self.app.defaults["tools_drill_dwell"] job_obj.dwelltime = self.app.defaults["tools_drill_dwelltime"] - # laser minimum power - job_obj.laser_min_power = float(args["las_min_pwr"]) if "las_min_pwr" in args else 0.0 - job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"]) job_obj.fr_decimals = int(self.app.defaults["cncjob_fr_decimals"])