diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b01ee2..2068e6e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ CHANGELOG for FlatCAM beta - Milling Tool - selecting an object on canvas will update the selection of the object combobox, if the selected object type is the same sa the one selected in the Target radio - Milling Tool - changing parameters for the Geo Tool table now updates correctly the storage and are used in the CNCJob object that is created - Milling Tool - after creating and CNCJob object, it is now auto-selected and the Property tab is automatically switched to +- Milling Tool - various fixes +- Line_xyx preprocessor - fixed when using multidepth cut to use the right depth 29.11.2020 diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py index 4c8d9246..f9a259a0 100644 --- a/appTools/ToolMilling.py +++ b/appTools/ToolMilling.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui from appTool import AppTool from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, FCComboBox2, \ - FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalEntry, OptionalHideInputSection, FCLabel + FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalTupleEntry, OptionalHideInputSection, FCLabel from appParsers.ParseExcellon import Excellon from camlib import Geometry, grace @@ -1894,8 +1894,9 @@ class ToolMilling(AppTool, Excellon): # update Tool dia self.target_obj.tools[tooluid]['tooldia'] = tool_dia - # update Cut Z if V shape tool - self.on_update_cutz() + # update Cut Z if the tool has a V shape tool + if self.ui.geo_tools_table.cellWidget(current_row, 2).get_value() == 'V': + self.on_update_cutz() try: self.target_obj.ser_attrs.remove('tools') @@ -2450,7 +2451,7 @@ class ToolMilling(AppTool, Excellon): else: self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No tool selected in the tool table ...")) - def mtool_gen_cncjob(self, outname=None, tools_dict=None, tools_in_use=None, segx=None, segy=None, + def mtool_gen_cncjob(self, outname=None, tools_dict=None, tools_in_use=None, segx=None, segy=None, toolchange=None, plot=True, use_thread=True): """ Creates a multi-tool CNCJob out of this Geometry object. @@ -2494,6 +2495,8 @@ class ToolMilling(AppTool, Excellon): # force everything as MULTI-GEO # self.multigeo = True + is_toolchange = toolchange if toolchange is not None else self.ui.toolchange_cb.get_value() + # Object initialization function for app.app_obj.new_object() # RUNNING ON SEPARATE THREAD! def job_init_single_geometry(job_obj, app_obj): @@ -2695,8 +2698,35 @@ class ToolMilling(AppTool, Excellon): }) if "optimization_type" not in tools_dict[tooluid_key]['data']: - tools_dict[tooluid_key]['data']["optimization_type"] = \ - self.app.defaults["geometry_optimization_type"] + def_optimization_type = self.app.defaults["geometry_optimization_type"] + tools_dict[tooluid_key]['data']["optimization_type"] = def_optimization_type + + # ##################################################################################################### + # ############################ COMMON Parameters ###################################################### + # ##################################################################################################### + + # Toolchange Z + tools_dict[tooluid_key]['data']['toolchangez'] = self.ui.toolchangez_entry.get_value() + # End Move Z + tools_dict[tooluid_key]['data']['endz'] = self.ui.endz_entry.get_value() + # End Move XY + tools_dict[tooluid_key]['data']['endxy'] = self.ui.endxy_entry.get_value() + # Probe Z + tools_dict[tooluid_key]['data']['z_pdepth'] = self.ui.pdepth_entry.get_value() + # Probe FR + tools_dict[tooluid_key]['data']['feedrate_probe'] = self.ui.feedrate_probe_entry.get_value() + + # Exclusion Areas Enable + tools_dict[tooluid_key]['data']['area_exclusion'] = self.ui.exclusion_cb.get_value() + # Exclusion Areas Shape + tools_dict[tooluid_key]['data']['area_shape'] = self.ui.area_shape_radio.get_value() + # Exclusion Areas Strategy + tools_dict[tooluid_key]['data']['area_strategy'] = self.ui.strategy_radio.get_value() + # Exclusion Areas Overz + tools_dict[tooluid_key]['data']['area_overz'] = self.ui.over_z_entry.get_value() + + # Preprocessor + tools_dict[tooluid_key]['data']['ppname_g'] = self.ui.pp_geo_name_cb.get_value() # Offset calculation offset_type = dia_cnc_dict['offset'].lower() @@ -2744,7 +2774,7 @@ class ToolMilling(AppTool, Excellon): res, start_gcode = new_obj.geometry_tool_gcode_gen(tooluid_key, tools_dict, first_pt=(0, 0), tolerance=tol, is_first=is_first, is_last=is_last, - toolchange=True) + toolchange=is_toolchange) if res == 'fail': log.debug("ToolMilling.mtool_gen_cncjob() --> geometry_tool_gcode_gen() failed") return 'fail' @@ -3995,7 +4025,7 @@ class MillingUI: "If no value is entered then there is no move\n" "on X,Y plane at the end of the job.") ) - self.endxy_entry = NumericalEvalEntry(border_color='#0069A9') + self.endxy_entry = NumericalEvalTupleEntry(border_color='#0069A9') self.endxy_entry.setPlaceholderText(_("X,Y coordinates")) self.grid3.addWidget(endmove_xy_label, 12, 0) self.grid3.addWidget(self.endxy_entry, 12, 1) diff --git a/camlib.py b/camlib.py index 8b12583a..5416efa9 100644 --- a/camlib.py +++ b/camlib.py @@ -3615,14 +3615,14 @@ class CNCjob(Geometry): self.xy_end = None else: # either originally it was a string or not, xy_end will be made string - self.xy_end = re.sub('[()\[\]]', '', str(self.xy_end)) if self.xy_end else None + self.xy_end = re.sub('[\(\)\[\]]', '', str(self.xy_end)) if self.xy_end else None # and now, xy_end is made into a list of floats in format [x, y] if self.xy_end: self.xy_end = [float(eval(a)) for a in self.xy_end.split(",")] if self.xy_end and len(self.xy_end) != 2: - self.app.inform.emit('[ERROR]%s' % _("The End X,Y format has to be (x, y).")) + self.app.inform.emit('[ERROR] %s' % _("The End X,Y format has to be (x, y).")) return 'fail' except Exception as e: log.debug("camlib.CNCJob.geometry_from_excellon_by_tool() xy_end --> %s" % str(e)) @@ -7097,7 +7097,7 @@ class CNCjob(Geometry): next_x = pt[0] next_y = pt[1] - gcode += self.doformat(p.linear_code, x=next_x, y=next_y, z=z_cut) # Linear motion to point + gcode += self.doformat(p.linear_code, x=next_x, y=next_y, z_cut=z_cut) # Linear motion to point prev_x = pt[0] prev_y = pt[1] @@ -7245,7 +7245,7 @@ class CNCjob(Geometry): next_x = pt[0] next_y = pt[1] - gcode += self.doformat(p.linear_code, x=next_x, y=next_y, z=z_cut) # Linear motion to point + gcode += self.doformat(p.linear_code, x=next_x, y=next_y, z_cut=z_cut) # Linear motion to point prev_x = next_x prev_y = next_y diff --git a/preprocessors/Line_xyz.py b/preprocessors/Line_xyz.py index 8ac992a1..9148903f 100644 --- a/preprocessors/Line_xyz.py +++ b/preprocessors/Line_xyz.py @@ -217,7 +217,7 @@ M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolcha def end_code(self, p): coords_xy = p['xy_end'] if coords_xy and coords_xy != '': - g = 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n" + g = 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) else: g = ('G00 ' + self.position_code(p)).format(**p) g += ' Z' + self.coordinate_format % (p.coords_decimals, p.z_end)