diff --git a/FlatCAMApp.py b/FlatCAMApp.py index b46d32ba..8091d821 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -3152,6 +3152,11 @@ class App(QtCore.QObject): :param initialize: Function to run after creation of the object but before it is attached to the application. The function is called with 2 parameters: the new object and the App instance. :type initialize: function + :param active: + :param fit: + :param plot: If to plot the resulting object + :param autoselected: if the resulting object is autoselected in the Project tab and therefore in the + self.colleaction :return: None :rtype: None """ @@ -3235,11 +3240,9 @@ class App(QtCore.QObject): obj.options['ymin'] = ymin obj.options['xmax'] = xmax obj.options['ymax'] = ymax - except: - log.warning("The object has no bounds properties.") - # don't plot objects with no bounds, there is nothing to plot - self.plot = False - pass + except Exception as e: + log.warning("The object has no bounds properties. %s" % str(e)) + return "fail" FlatCAMApp.App.log.debug("Moving new object back to main thread.") @@ -8962,7 +8965,6 @@ The normal flow when working in FlatCAM is the following:
:param objects: list of Objects to be enabled :return: """ - log.debug("Enabling plots ...") self.inform.emit(_("Working ...")) for obj in objects: diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 6a59fd0f..3b31f061 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -136,7 +136,6 @@ class FlatCAMObj(QtCore.QObject): def on_options_change(self, key): # Update form on programmatically options change self.set_form_item(key) - # Set object visibility if key == 'plot': self.visible = self.options['plot'] @@ -3423,7 +3422,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): self.ui.level.setText(_( 'Advanced' )) - self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click) self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click) self.ui.paint_tool_button.clicked.connect(lambda: self.app.paint_tool.run(toggle=False)) @@ -5203,11 +5201,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): for tooluid_key in self.tools: solid_geometry = self.tools[tooluid_key]['solid_geometry'] self.plot_element(solid_geometry, visible=visible) - - # plot solid geometry that may be an direct attribute of the geometry object - # for SingleGeo - if self.solid_geometry: - self.plot_element(self.solid_geometry, visible=visible) + else: + # plot solid geometry that may be an direct attribute of the geometry object + # for SingleGeo + if self.solid_geometry: + self.plot_element(self.solid_geometry, visible=visible) # self.plot_element(self.solid_geometry, visible=self.options['plot']) self.shapes.redraw() @@ -5217,8 +5215,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): def on_plot_cb_click(self, *args): if self.muted_ui: return - self.plot() self.read_form_item('plot') + self.plot() self.ui_disconnect() cb_flag = self.ui.plot_cb.isChecked() diff --git a/FlatCAMWorker.py b/FlatCAMWorker.py index 1461f989..9c93afe1 100644 --- a/FlatCAMWorker.py +++ b/FlatCAMWorker.py @@ -7,6 +7,7 @@ # ########################################################## ## from PyQt5 import QtCore +# import traceback class Worker(QtCore.QObject): @@ -60,6 +61,7 @@ class Worker(QtCore.QObject): task['fcn'](*task['params']) except Exception as e: self.app.thread_exception.emit(e) + # print(traceback.format_exc()) # raise e finally: self.task_completed.emit(self.name) diff --git a/README.md b/README.md index ba0d2dcc..4a1cd8d2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing. - started to update the app strings to make it easier for future translations - fixed the POT file and the German translation - some mods in the Tool Sub +- fixed bug in Tool Sub that created issues when toggling visibility of the plots 18.08.2019 diff --git a/flatcamTools/ToolSub.py b/flatcamTools/ToolSub.py index bdc78304..015e98de 100644 --- a/flatcamTools/ToolSub.py +++ b/flatcamTools/ToolSub.py @@ -416,7 +416,10 @@ class ToolSub(FlatCAMTool): # cleanup self.new_apertures.clear() self.new_solid_geometry[:] = [] - self.sub_union[:] = [] + try: + self.sub_union[:] = [] + except TypeError: + self.sub_union = [] def on_geo_intersection_click(self): # reset previous values @@ -458,10 +461,10 @@ class ToolSub(FlatCAMTool): return # create the target_options obj - self.target_options = dict() - for opt in self.target_geo_obj.options: - if opt != 'name': - self.target_options[opt] = deepcopy(self.target_geo_obj.options[opt]) + # self.target_options = dict() + # for k, v in self.target_geo_obj.options.items(): + # if k != 'name': + # self.target_options[k] = v # crate the new_tools dict structure for tool in self.target_geo_obj.tools: @@ -576,7 +579,10 @@ class ToolSub(FlatCAMTool): geo_name = outname def obj_init(geo_obj, app_obj): - geo_obj.options = deepcopy(self.target_options) + # geo_obj.options = self.target_options + # create the target_options obj + for k, v in self.target_geo_obj.options.items(): + geo_obj.options[k] = v geo_obj.options['name'] = geo_name if self.target_geo_obj.multigeo: @@ -592,6 +598,7 @@ class ToolSub(FlatCAMTool): geo_obj.tools[tool]['solid_geometry'] = deepcopy(self.new_solid_geometry) except Exception as e: log.debug("ToolSub.new_geo_object() --> %s" % str(e)) + geo_obj.multigeo = False with self.app.proc_container.new(_("Generating new object ...")): ret = self.app.new_object('geometry', outname, obj_init, autoselected=False) @@ -606,7 +613,7 @@ class ToolSub(FlatCAMTool): # cleanup self.new_tools.clear() self.new_solid_geometry[:] = [] - self.sub_union[:] = [] + self.sub_union = [] def periodic_check(self, check_period, reset=False): """