From cefbcd1816ed4a9ba3cf701bf0d7b5171b9516fe Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 28 Nov 2019 00:49:21 +0200 Subject: [PATCH] - small fixes in NCC Tool and in the FlatCAMGeometry class --- FlatCAMObj.py | 12 ++++++++++-- README.md | 6 +++++- flatcamTools/ToolNonCopperClear.py | 19 +++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 3835dd0c..80b2c6af 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -3694,6 +3694,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): "toolchange": self.ui.toolchangeg_cb, "toolchangez": self.ui.toolchangez_entry, "endz": self.ui.gendz_entry, + "cnctooldia": self.ui.addtool_entry }) # Fill form fields only on object create @@ -4438,9 +4439,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): half_vangle = float(self.ui.tipangle_entry.get_value()) / 2 row = self.ui.geo_tools_table.currentRow() - tool_uid = int(self.ui.geo_tools_table.item(row, 5).text()) + tool_uid_item = self.ui.geo_tools_table.item(row, 5) + if tool_uid_item is None: + return + tool_uid = int(tool_uid_item.text()) + + tool_dia_item = self.ui.geo_tools_table.item(row, 1) + if tool_dia_item is None: + return + tooldia = float(tool_dia_item.text()) - tooldia = float(self.ui.geo_tools_table.item(row, 1).text()) new_cutz = (tooldia - vdia) / (2 * math.tan(math.radians(half_vangle))) new_cutz = float('%.*f' % (self.decimals, new_cutz)) * -1.0 # this value has to be negative diff --git a/README.md b/README.md index 69ae9fa1..61158ab2 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,16 @@ CAD program, and create G-Code for Isolation routing. ================================================= +28.11.2019 + +- small fixes in NCC Tool and in the FlatCAMGeometry class + 27.11.2019 - in Tool Film added the page size and page orientation in case of saving the film as PDF file - the application workspace has now a lot more options selectable in the Edit -> Preferences -> General -> GUI Preferences - updated the drawing of the workspace such that the application overall start time is improved and after first turn on of the workspace, toggling it will have no performance penalty -- updated the workspace functions to work in Legacy(@D) graphic mode +- updated the workspace functions to work in Legacy(2D) graphic mode - adjusted the selection color transparency for the Legacy(2D) graphic mode because it was too transparent for the fill 26.11.2019 diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index 4a56c66e..0ea08d00 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -248,7 +248,7 @@ class NonCopperClear(FlatCAMTool, Gerber): self.tipangle_entry.setSingleStep(5) grid1.addWidget(self.tipanglelabel, 6, 0) - grid1.addWidget(self.tipangle_entry, 6 , 1) + grid1.addWidget(self.tipangle_entry, 6, 1) # Cut Z entry cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z')) @@ -538,6 +538,8 @@ class NonCopperClear(FlatCAMTool, Gerber): self.grb_circle_steps = int(self.app.defaults["gerber_circle_steps"]) + self.tooldia = None + # ############################################################################# # ############################ SGINALS ######################################## # ############################################################################# @@ -1138,7 +1140,7 @@ class NonCopperClear(FlatCAMTool, Gerber): self.ncc_obj = self.app.collection.get_by_name(self.obj_name) except Exception as e: self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(self.obj_name))) - return "Could not retrieve object: %s" % self.obj_name + return "Could not retrieve object: %s with error: %s" % (self.obj_name, str(e)) if self.ncc_obj is None: self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Object not found"), str(self.obj_name))) @@ -1179,7 +1181,7 @@ class NonCopperClear(FlatCAMTool, Gerber): self.bound_obj = self.app.collection.get_by_name(self.bound_obj_name) except Exception as e: self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), self.bound_obj_name)) - return "Could not retrieve object: %s" % self.bound_obj_name + return "Could not retrieve object: %s with error: %s" % (self.bound_obj_name, str(e)) self.clear_copper(ncc_obj=self.ncc_obj, ncctooldia=self.ncc_dia_list, @@ -1609,11 +1611,10 @@ class NonCopperClear(FlatCAMTool, Gerber): sol_geo = ncc_obj.solid_geometry if has_offset is True: - app_obj.inform.emit('[WARNING_NOTCL] %s ...' % - _("Buffering")) + app_obj.inform.emit('[WARNING_NOTCL] %s ...' % _("Buffering")) sol_geo = sol_geo.buffer(distance=ncc_offset) - app_obj.inform.emit('[success] %s ...' % - _("Buffering finished")) + app_obj.inform.emit('[success] %s ...' % _("Buffering finished")) + empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box) if empty == 'fail': return 'fail' @@ -1890,6 +1891,7 @@ class NonCopperClear(FlatCAMTool, Gerber): tools_storage.pop(k, None) geo_obj.options["cnctooldia"] = str(tool) + geo_obj.multigeo = True geo_obj.tools.clear() geo_obj.tools = dict(tools_storage) @@ -2302,11 +2304,12 @@ class NonCopperClear(FlatCAMTool, Gerber): if run_threaded: proc.done() return - except Exception as e: + except Exception: if run_threaded: proc.done() traceback.print_stack() return + if run_threaded: proc.done() else: