- added to the NonCopperClear.clear_copper() a parameter to be able to run it non-threaded

This commit is contained in:
Marius Stanciu
2019-09-14 18:27:08 +03:00
committed by Marius
parent 297d5abb48
commit 57f4762261
5 changed files with 30 additions and 18 deletions

View File

@@ -5150,15 +5150,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
# it seems that the tolerance needs to be a lot lower value than 0.01 and it was hardcoded initially # it seems that the tolerance needs to be a lot lower value than 0.01 and it was hardcoded initially
# to a value of 0.0005 which is 20 times less than 0.01 # to a value of 0.0005 which is 20 times less than 0.01
tol = float(self.app.defaults['global_tolerance']) / 20 tol = float(self.app.defaults['global_tolerance']) / 20
job_obj.generate_from_geometry_2(self, tooldia=tooldia, offset=offset, tolerance=tol, job_obj.generate_from_geometry_2(
z_cut=z_cut, z_move=z_move, self, tooldia=tooldia, offset=offset, tolerance=tol,
feedrate=feedrate, feedrate_z=feedrate_z, feedrate_rapid=feedrate_rapid, z_cut=z_cut, z_move=z_move,
spindlespeed=spindlespeed, dwell=dwell, dwelltime=dwelltime, feedrate=feedrate, feedrate_z=feedrate_z, feedrate_rapid=feedrate_rapid,
multidepth=multidepth, depthpercut=depthperpass, spindlespeed=spindlespeed, dwell=dwell, dwelltime=dwelltime,
toolchange=toolchange, toolchangez=toolchangez, toolchangexy=toolchangexy, multidepth=multidepth, depthpercut=depthperpass,
extracut=extracut, startz=startz, endz=endz, toolchange=toolchange, toolchangez=toolchangez, toolchangexy=toolchangexy,
pp_geometry_name=ppname_g extracut=extracut, startz=startz, endz=endz,
) pp_geometry_name=ppname_g
)
app_obj.progress.emit(50) app_obj.progress.emit(50)
# tell gcode_parse from which point to start drawing the lines depending on what kind of object is the # tell gcode_parse from which point to start drawing the lines depending on what kind of object is the

View File

@@ -22,6 +22,7 @@ CAD program, and create G-Code for Isolation routing.
- whenever the user changes the Excellon format values for loading files, the Export Excellon Format values will be updated - whenever the user changes the Excellon format values for loading files, the Export Excellon Format values will be updated
- made optional the behavior of Excellon Export values following the values in the Excellon Loading section - made optional the behavior of Excellon Export values following the values in the Excellon Loading section
- updated the translations (except RU) and the POT file - updated the translations (except RU) and the POT file
- added to the NonCopperClear.clear_copper() a parameter to be able to run it non-threaded
13.09.2019 13.09.2019

View File

@@ -1291,7 +1291,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
order=None, order=None,
method=None, method=None,
rest=None, rest=None,
tools_storage=None): tools_storage=None,
run_threaded=True):
""" """
Clear the excess copper from the entire object. Clear the excess copper from the entire object.
@@ -1312,6 +1313,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
:param rest: True if to use rest-machining :param rest: True if to use rest-machining
:param tools_storage: whether to use the current tools_storage self.ncc_tools or a different one. :param tools_storage: whether to use the current tools_storage self.ncc_tools or a different one.
Usage of the different one is related to when this function is called from a TcL command. Usage of the different one is related to when this function is called from a TcL command.
:param run_threaded: If True the method will be run in a threaded way suitable for GUI usage; if False it will
run non-threaded for TclShell usage
:return: :return:
""" """
@@ -2200,11 +2203,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
# focus on Selected Tab # focus on Selected Tab
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab) self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
# Promise object with the new name if run_threaded:
self.app.collection.promise(name) # Promise object with the new name
self.app.collection.promise(name)
# Background # Background
self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]}) self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
else:
job_thread(app_obj=self.app)
# def on_ncc(self): # def on_ncc(self):
# #

View File

@@ -111,5 +111,7 @@ class TclCommandCncjob(TclCommandSignaled):
# HACK !!! Should be solved elsewhere!!! # HACK !!! Should be solved elsewhere!!!
# default option for multidepth is False # default option for multidepth is False
obj.options['multidepth'] = False obj.options['multidepth'] = False
if not obj.multigeo:
obj.generatecncjob(use_thread=False, **args) obj.generatecncjob(use_thread=False, **args)
else:
self.raise_tcl_error('The object is a multi-geo geometry which is not supported in cncjob Tcl Command')

View File

@@ -225,7 +225,8 @@ class TclCommandCopperClear(TclCommand):
connect=connect, connect=connect,
contour=contour, contour=contour,
rest=rest, rest=rest,
tools_storage=ncc_tools) tools_storage=ncc_tools,
run_threaded=False)
return return
# Non-Copper clear all polygons found within the box object from the the non_copper cleared object # Non-Copper clear all polygons found within the box object from the the non_copper cleared object
@@ -257,7 +258,8 @@ class TclCommandCopperClear(TclCommand):
connect=connect, connect=connect,
contour=contour, contour=contour,
rest=rest, rest=rest,
tools_storage=ncc_tools) tools_storage=ncc_tools,
run_threaded=False)
return return
else: else:
self.raise_tcl_error("%s:" % _("None of the following args: 'ref', 'all' were found or none was set to 1.\n" self.raise_tcl_error("%s:" % _("None of the following args: 'ref', 'all' were found or none was set to 1.\n"