diff --git a/CHANGELOG.md b/CHANGELOG.md index bcfa5835..286dbc29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ CHANGELOG for FlatCAM beta - allowed some more parameters to have negative values (tool diameters especially) - some more tools now have a Beginner/Advanced mode - for QRCode and Subtraction Tools added also a Beginner/Advanced mode +- in NCC Tool fixed issue #486 where creating Area Selection shapes of type Square with Grid snap OFF will not use the first click position +- fixed a bug in Paint Tool when doing Painting Area Selection and nothing is no polygon is in the selections to be painted +- fixed Isolation, Paint and NCC Tools to use the Tool Type parameter from Preferences on adding new tools and also setting the 'type' key in tools dict correctly 5.01.2021 diff --git a/appTools/ToolIsolation.py b/appTools/ToolIsolation.py index 8e9d93d7..4b252d33 100644 --- a/appTools/ToolIsolation.py +++ b/appTools/ToolIsolation.py @@ -1419,8 +1419,8 @@ class ToolIsolation(AppTool, Gerber): 'tooldia': truncated_tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': ' Iso', - 'tool_type': 'V', + 'type': 'Iso' if self.app.defaults["tools_iso_tool_type"] == 'V' else 'Rough', + 'tool_type': deepcopy(self.app.defaults["tools_iso_tool_type"]), 'data': deepcopy(self.default_data), 'solid_geometry': [] } diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py index b4dc64b2..8626e517 100644 --- a/appTools/ToolNCC.py +++ b/appTools/ToolNCC.py @@ -1380,7 +1380,7 @@ class NonCopperClear(AppTool, Gerber): 'tooldia': truncated_tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': 'Iso', + 'type': 'Iso' if self.app.defaults["tools_ncc_tool_type"] == 'V' else 'Rough', 'tool_type': deepcopy(self.app.defaults["tools_ncc_tool_type"]), 'data': deepcopy(self.default_data), 'solid_geometry': [] @@ -1678,9 +1678,7 @@ class NonCopperClear(AppTool, Gerber): self.first_click = True self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the end point of the area.")) - self.cursor_pos = self.app.plotcanvas.translate_coords(event_pos) - if self.app.grid_status(): - self.cursor_pos = self.app.geo_editor.snap(event_pos[0], event_pos[1]) + self.cursor_pos = (curr_pos[0], curr_pos[1]) else: self.app.inform.emit(_("Zone added. Click to start adding next zone or right click to finish.")) self.app.delete_selection_shape() diff --git a/appTools/ToolPaint.py b/appTools/ToolPaint.py index 34c32821..4136b33a 100644 --- a/appTools/ToolPaint.py +++ b/appTools/ToolPaint.py @@ -978,8 +978,8 @@ class ToolPaint(AppTool, Gerber): 'tooldia': truncated_tooldia, 'offset': 'Path', 'offset_value': 0.0, - 'type': 'Iso', - 'tool_type': 'V', + 'type': 'Iso' if self.app.defaults["tools_paint_tool_type"] == 'V' else 'Rough', + 'tool_type': deepcopy(self.app.defaults["tools_paint_tool_type"]), 'data': deepcopy(self.default_data), 'solid_geometry': [] } @@ -1919,7 +1919,8 @@ class ToolPaint(AppTool, Gerber): poly_buf.append(buffered_pol) if not poly_buf: - self.app.inform.emit('[WARNING_NOTCL] %s' % _("Margin parameter too big. Tool is not used")) + self.app.inform.emit( + '[ERROR_NOTCL] %s' % _("There is no geometry to process or the tool diameter is too big.")) continue # variables to display the percentage of work done @@ -2067,7 +2068,8 @@ class ToolPaint(AppTool, Gerber): poly_buf = unary_union(poly_buf) if not poly_buf: - self.app.inform.emit('[WARNING_NOTCL] %s' % _("Margin parameter too big. Tool is not used")) + self.app.inform.emit( + '[ERROR_NOTCL] %s' % _("There is no geometry to process or the tool diameter is too big.")) return 'fail' # variables to display the percentage of work done @@ -2512,7 +2514,7 @@ class ToolPaint(AppTool, Gerber): # ## If iterable, expand recursively. try: for geo in geometry: - if geo is not None: + if geo and not geo.is_empty and geo.is_valid: recurse(geometry=geo, reset=False) # ## Not iterable, do the actual indexing and add. @@ -2544,14 +2546,15 @@ class ToolPaint(AppTool, Gerber): self.app.inform.emit('%s %s' % (_("Paint Tool."), _("Painting area task started."))) geo_to_paint = target_geo.intersection(sel_obj) - painted_area = recurse(geo_to_paint) # No polygon? - if not painted_area: + if not geo_to_paint or geo_to_paint.is_empty: self.app.log.warning('No polygon found.') self.app.inform.emit('[WARNING] %s' % _('No polygon found.')) return + painted_area = recurse(geo_to_paint, reset=True) + self.paint_geo(obj, painted_area, tooldia=tooldia, order=order, method=method, outname=outname, tools_storage=tools_storage, plot=plot, run_threaded=run_threaded) diff --git a/defaults.py b/defaults.py index cfe971bf..8c754038 100644 --- a/defaults.py +++ b/defaults.py @@ -470,7 +470,7 @@ class FlatCAMDefaults: "tools_al_grbl_travelz": 15.0, # NCC Tool - "tools_ncc_tools": "1.0, 0.5", + "tools_ncc_tools": "0.5", "tools_ncc_order": 'rev', "tools_ncc_operation": 'clear', "tools_ncc_overlap": 40,