- Milling Tool - various fixes

- Line_xyx preprocessor - fixed when using multidepth cut to use the right depth
This commit is contained in:
Marius Stanciu
2020-12-02 02:11:05 +02:00
committed by Marius
parent d58c56ba7d
commit c6160085ab
4 changed files with 45 additions and 13 deletions

View File

@@ -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 - 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 - 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 - 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 29.11.2020

View File

@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
from appTool import AppTool from appTool import AppTool
from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, FCComboBox2, \ 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 appParsers.ParseExcellon import Excellon
from camlib import Geometry, grace from camlib import Geometry, grace
@@ -1894,8 +1894,9 @@ class ToolMilling(AppTool, Excellon):
# update Tool dia # update Tool dia
self.target_obj.tools[tooluid]['tooldia'] = tool_dia self.target_obj.tools[tooluid]['tooldia'] = tool_dia
# update Cut Z if V shape tool # update Cut Z if the tool has a V shape tool
self.on_update_cutz() if self.ui.geo_tools_table.cellWidget(current_row, 2).get_value() == 'V':
self.on_update_cutz()
try: try:
self.target_obj.ser_attrs.remove('tools') self.target_obj.ser_attrs.remove('tools')
@@ -2450,7 +2451,7 @@ class ToolMilling(AppTool, Excellon):
else: else:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No tool selected in the tool table ...")) 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): plot=True, use_thread=True):
""" """
Creates a multi-tool CNCJob out of this Geometry object. Creates a multi-tool CNCJob out of this Geometry object.
@@ -2494,6 +2495,8 @@ class ToolMilling(AppTool, Excellon):
# force everything as MULTI-GEO # force everything as MULTI-GEO
# self.multigeo = True # 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() # Object initialization function for app.app_obj.new_object()
# RUNNING ON SEPARATE THREAD! # RUNNING ON SEPARATE THREAD!
def job_init_single_geometry(job_obj, app_obj): 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']: if "optimization_type" not in tools_dict[tooluid_key]['data']:
tools_dict[tooluid_key]['data']["optimization_type"] = \ def_optimization_type = self.app.defaults["geometry_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 calculation
offset_type = dia_cnc_dict['offset'].lower() 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), res, start_gcode = new_obj.geometry_tool_gcode_gen(tooluid_key, tools_dict, first_pt=(0, 0),
tolerance=tol, tolerance=tol,
is_first=is_first, is_last=is_last, is_first=is_first, is_last=is_last,
toolchange=True) toolchange=is_toolchange)
if res == 'fail': if res == 'fail':
log.debug("ToolMilling.mtool_gen_cncjob() --> geometry_tool_gcode_gen() failed") log.debug("ToolMilling.mtool_gen_cncjob() --> geometry_tool_gcode_gen() failed")
return 'fail' return 'fail'
@@ -3995,7 +4025,7 @@ class MillingUI:
"If no value is entered then there is no move\n" "If no value is entered then there is no move\n"
"on X,Y plane at the end of the job.") "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.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
self.grid3.addWidget(endmove_xy_label, 12, 0) self.grid3.addWidget(endmove_xy_label, 12, 0)
self.grid3.addWidget(self.endxy_entry, 12, 1) self.grid3.addWidget(self.endxy_entry, 12, 1)

View File

@@ -3615,14 +3615,14 @@ class CNCjob(Geometry):
self.xy_end = None self.xy_end = None
else: else:
# either originally it was a string or not, xy_end will be made string # 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] # and now, xy_end is made into a list of floats in format [x, y]
if self.xy_end: if self.xy_end:
self.xy_end = [float(eval(a)) for a in self.xy_end.split(",")] self.xy_end = [float(eval(a)) for a in self.xy_end.split(",")]
if self.xy_end and len(self.xy_end) != 2: 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' return 'fail'
except Exception as e: except Exception as e:
log.debug("camlib.CNCJob.geometry_from_excellon_by_tool() xy_end --> %s" % str(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_x = pt[0]
next_y = pt[1] 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_x = pt[0]
prev_y = pt[1] prev_y = pt[1]
@@ -7245,7 +7245,7 @@ class CNCjob(Geometry):
next_x = pt[0] next_x = pt[0]
next_y = pt[1] 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_x = next_x
prev_y = next_y prev_y = next_y

View File

@@ -217,7 +217,7 @@ M0""".format(x_toolchange=self.coordinate_format % (p.coords_decimals, x_toolcha
def end_code(self, p): def end_code(self, p):
coords_xy = p['xy_end'] coords_xy = p['xy_end']
if coords_xy and coords_xy != '': 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: else:
g = ('G00 ' + self.position_code(p)).format(**p) g = ('G00 ' + self.position_code(p)).format(**p)
g += ' Z' + self.coordinate_format % (p.coords_decimals, p.z_end) g += ' Z' + self.coordinate_format % (p.coords_decimals, p.z_end)