- small fixes

This commit is contained in:
Marius Stanciu
2019-11-24 04:21:18 +02:00
committed by Marius
parent d03428f860
commit aac4fd75ca
4 changed files with 66 additions and 48 deletions

View File

@@ -6367,14 +6367,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
if 'M6' in g: if 'M6' in g:
m6_code = self.parse_custom_toolchange_code(self.ui.toolchange_text.get_value()) m6_code = self.parse_custom_toolchange_code(self.ui.toolchange_text.get_value())
if m6_code is None or m6_code == '': if m6_code is None or m6_code == '':
self.app.inform.emit('[ERROR_NOTCL] %s' % self.app.inform.emit(
_("Cancelled. The Toolchange Custom code is enabled but it's empty.") '[ERROR_NOTCL] %s' % _("Cancelled. The Toolchange Custom code is enabled but it's empty.")
) )
return 'fail' return 'fail'
g = g.replace('M6', m6_code) g = g.replace('M6', m6_code)
self.app.inform.emit('[success] %s' % self.app.inform.emit('[success] %s' % _("Toolchange G-code was replaced by a custom code."))
_("Toolchange G-code was replaced by a custom code."))
lines = StringIO(g) lines = StringIO(g)
@@ -6391,13 +6390,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
for line in lines: for line in lines:
f.write(line) f.write(line)
except FileNotFoundError: except FileNotFoundError:
self.app.inform.emit('[WARNING_NOTCL] %s' % self.app.inform.emit('[WARNING_NOTCL] %s' % _("No such file or directory"))
_("No such file or directory"))
return return
except PermissionError: except PermissionError:
self.app.inform.emit('[WARNING] %s' % self.app.inform.emit(
_("Permission denied, saving not possible.\n" '[WARNING] %s' % _("Permission denied, saving not possible.\n"
"Most likely another app is holding the file open and not accessible.")) "Most likely another app is holding the file open and not accessible.")
)
return 'fail' return 'fail'
elif to_file is False: elif to_file is False:
# Just for adding it to the recent files list. # Just for adding it to the recent files list.
@@ -6405,8 +6404,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.app.file_opened.emit("cncjob", filename) self.app.file_opened.emit("cncjob", filename)
self.app.file_saved.emit("cncjob", filename) self.app.file_saved.emit("cncjob", filename)
self.app.inform.emit('[success] %s: %s' % self.app.inform.emit('[success] %s: %s' % (_("Saved to"), filename))
(_("Saved to"), filename))
else: else:
return lines return lines

View File

@@ -2956,7 +2956,8 @@ class CNCjob(Geometry):
self.app.inform.emit(_("Finished G-Code generation...")) self.app.inform.emit(_("Finished G-Code generation..."))
return 'OK' return 'OK'
def generate_from_multitool_geometry(self, geometry, append=True, def generate_from_multitool_geometry(
self, geometry, append=True,
tooldia=None, offset=0.0, tolerance=0, z_cut=1.0, z_move=2.0, tooldia=None, offset=0.0, tolerance=0, z_cut=1.0, z_move=2.0,
feedrate=2.0, feedrate_z=2.0, feedrate_rapid=30, feedrate=2.0, feedrate_z=2.0, feedrate_rapid=30,
spindlespeed=None, spindledir='CW', dwell=False, dwelltime=1.0, spindlespeed=None, spindledir='CW', dwell=False, dwelltime=1.0,
@@ -2973,12 +2974,28 @@ class CNCjob(Geometry):
:param geometry: :param geometry:
:param append: :param append:
:param tooldia: :param tooldia:
:param offset:
:param tolerance: :param tolerance:
:param multidepth: If True, use multiple passes to reach :param z_cut:
the desired depth. :param z_move:
:param feedrate:
:param feedrate_z:
:param feedrate_rapid:
:param spindlespeed:
:param spindledir:
:param dwell:
:param dwelltime:
:param multidepth: If True, use multiple passes to reach the desired depth.
:param depthpercut: Maximum depth in each pass. :param depthpercut: Maximum depth in each pass.
:param extracut: Adds (or not) an extra cut at the end of each path :param toolchange:
overlapping the first point in path to ensure complete copper removal :param toolchangez:
:param toolchangexy:
:param extracut: Adds (or not) an extra cut at the end of each path overlapping the
first point in path to ensure complete copper removal
:param startz:
:param endz:
:param pp_geometry_name:
:param tool_no:
:return: GCode - string :return: GCode - string
""" """
@@ -3063,8 +3080,7 @@ class CNCjob(Geometry):
return 'fail' return 'fail'
if self.z_move is None: if self.z_move is None:
self.app.inform.emit('[ERROR_NOTCL] %s' % self.app.inform.emit('[ERROR_NOTCL] %s' % _("Travel Z parameter is None or zero."))
_("Travel Z parameter is None or zero."))
return 'fail' return 'fail'
if self.z_move < 0: if self.z_move < 0:
@@ -3164,7 +3180,7 @@ class CNCjob(Geometry):
# variables to display the percentage of work done # variables to display the percentage of work done
geo_len = len(flat_geometry) geo_len = len(flat_geometry)
disp_number = 0
old_disp_number = 0 old_disp_number = 0
log.warning("Number of paths for which to generate GCode: %s" % str(geo_len)) log.warning("Number of paths for which to generate GCode: %s" % str(geo_len))
@@ -3173,11 +3189,9 @@ class CNCjob(Geometry):
else: else:
current_tooldia = float('%.4f' % float(self.tooldia)) current_tooldia = float('%.4f' % float(self.tooldia))
self.app.inform.emit( self.app.inform.emit( '%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
'%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
str(current_tooldia), str(current_tooldia),
str(self.units)) str(self.units)))
)
pt, geo = storage.nearest(current_pt) pt, geo = storage.nearest(current_pt)
@@ -3288,11 +3302,11 @@ class CNCjob(Geometry):
# if solid_geometry is empty raise an exception # if solid_geometry is empty raise an exception
if not geometry.solid_geometry: if not geometry.solid_geometry:
self.app.inform.emit('[ERROR_NOTCL] %s' % self.app.inform.emit(
_("Trying to generate a CNC Job " '[ERROR_NOTCL] %s' % _("Trying to generate a CNC Job from a Geometry object without solid_geometry.")
"from a Geometry object without solid_geometry.")) )
temp_solid_geometry = [] temp_solid_geometry = list()
def bounds_rec(obj): def bounds_rec(obj):
if type(obj) is list: if type(obj) is list:

View File

@@ -127,7 +127,7 @@ class ToolCopperThieving(FlatCAMTool):
], orientation='vertical', stretch=False) ], orientation='vertical', stretch=False)
self.reference_label = QtWidgets.QLabel(_("Reference:")) self.reference_label = QtWidgets.QLabel(_("Reference:"))
self.reference_label.setToolTip( self.reference_label.setToolTip(
_("- 'Itself' - the copper thieving extent is based on the object that is copper cleared.\n " _("- 'Itself' - the copper thieving extent is based on the object that is copper cleared.\n"
"- 'Area Selection' - left mouse click to start selection of the area to be filled.\n" "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
"- 'Reference Object' - will do copper thieving within the area specified by another object.") "- 'Reference Object' - will do copper thieving within the area specified by another object.")
) )
@@ -171,7 +171,7 @@ class ToolCopperThieving(FlatCAMTool):
], stretch=False) ], stretch=False)
self.bbox_type_label = QtWidgets.QLabel(_("Box Type:")) self.bbox_type_label = QtWidgets.QLabel(_("Box Type:"))
self.bbox_type_label.setToolTip( self.bbox_type_label.setToolTip(
_("- 'Rectangular' - the bounding box will be of rectangular shape.\n " _("- 'Rectangular' - the bounding box will be of rectangular shape.\n"
"- 'Minimal' - the bounding box will be the convex hull shape.") "- 'Minimal' - the bounding box will be the convex hull shape.")
) )
grid_lay.addWidget(self.bbox_type_label, 6, 0) grid_lay.addWidget(self.bbox_type_label, 6, 0)
@@ -193,7 +193,7 @@ class ToolCopperThieving(FlatCAMTool):
], orientation='vertical', stretch=False) ], orientation='vertical', stretch=False)
self.fill_type_label = QtWidgets.QLabel(_("Fill Type:")) self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
self.fill_type_label.setToolTip( self.fill_type_label.setToolTip(
_("- 'Solid' - copper thieving will be a solid polygon.\n " _("- 'Solid' - copper thieving will be a solid polygon.\n"
"- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n" "- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
"- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n" "- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
"- 'Lines Grid' - the empty area will be filled with a pattern of lines.") "- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
@@ -412,10 +412,11 @@ class ToolCopperThieving(FlatCAMTool):
self.geo_steps_per_circle = 128 self.geo_steps_per_circle = 128
# SIGNALS # SIGNALS
self.fill_button.clicked.connect(self.execute)
self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type) self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
self.reference_radio.group_toggle_fn = self.on_toggle_reference self.reference_radio.group_toggle_fn = self.on_toggle_reference
self.fill_type_radio.activated_custom.connect(self.on_thieving_type) self.fill_type_radio.activated_custom.connect(self.on_thieving_type)
self.fill_button.clicked.connect(self.execute)
self.rb_button.clicked.connect(self.add_robber_bar) self.rb_button.clicked.connect(self.add_robber_bar)
def run(self, toggle=True): def run(self, toggle=True):

View File

@@ -425,6 +425,8 @@ class ToolFiducials(FlatCAMTool):
self.sec_position = self.pos_radio.get_value() self.sec_position = self.pos_radio.get_value()
fid_type = self.fid_type_radio.get_value() fid_type = self.fid_type_radio.get_value()
self.click_points = list()
# get the Gerber object on which the Fiducial will be inserted # get the Gerber object on which the Fiducial will be inserted
selection_index = self.grb_object_combo.currentIndex() selection_index = self.grb_object_combo.currentIndex()
model_index = self.app.collection.index(selection_index, 0, self.grb_object_combo.rootModelIndex()) model_index = self.app.collection.index(selection_index, 0, self.grb_object_combo.rootModelIndex())
@@ -756,11 +758,14 @@ class ToolFiducials(FlatCAMTool):
elif len(self.click_points) == 3: elif len(self.click_points) == 3:
self.sec_points_coords_entry.set_value(self.click_points[2]) self.sec_points_coords_entry.set_value(self.click_points[2])
self.app.inform.emit('[success] %s' % _("Done. All fiducials have been added.")) self.app.inform.emit('[success] %s' % _("Done. All fiducials have been added."))
self.add_fiducials_geo(self.click_points) self.add_fiducials_geo(self.click_points, g_obj=self.grb_object, fid_type=fid_type)
self.grb_object.source_file = self.app.export_gerber(obj_name=self.grb_object.options['name'],
filename=None,
local_use=self.grb_object, use_thread=False)
self.on_exit() self.on_exit()
else: else:
if len(self.click_points) == 2: if len(self.click_points) == 2:
self.sec_points_coords_entry.set_value(self.click_points[2]) self.top_right_coords_entry.set_value(self.click_points[1])
self.app.inform.emit('[success] %s' % _("Done. All fiducials have been added.")) self.app.inform.emit('[success] %s' % _("Done. All fiducials have been added."))
self.add_fiducials_geo(self.click_points, g_obj=self.grb_object, fid_type=fid_type) self.add_fiducials_geo(self.click_points, g_obj=self.grb_object, fid_type=fid_type)
self.grb_object.source_file = self.app.export_gerber(obj_name=self.grb_object.options['name'], self.grb_object.source_file = self.app.export_gerber(obj_name=self.grb_object.options['name'],