- Levelling Tool - mare sure that there are no duplicate seed points when creating Voronoi polygons

- Levelling Tool - fix of missing variable declaration (forgot to take everything when I moved the functionality from the CNCJob class to its own class)
This commit is contained in:
Marius Stanciu
2021-03-07 20:44:34 +02:00
committed by Marius
parent 62a749496b
commit 9855405b2e
3 changed files with 18 additions and 4 deletions

View File

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
================================================= =================================================
7.03.2021
- Levelling Tool - mare sure that there are no duplicate seed points when creating Voronoi polygons
- Levelling Tool - fix of missing variable declaration (forgot to take everything when I moved the functionality from the CNCJob class to its own class)
6.03.2021 6.03.2021
- some minor updates to NCC Tool - some minor updates to NCC Tool

View File

@@ -164,9 +164,6 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.source_file = '' self.source_file = ''
self.units_found = self.app.defaults['units'] self.units_found = self.app.defaults['units']
# store the current selection shape status to be restored after manual adding test points
self.old_selection_state = self.app.defaults['global_selection_shape']
self.prepend_snippet = '' self.prepend_snippet = ''
self.append_snippet = '' self.append_snippet = ''
self.gc_header = self.gcode_header() self.gc_header = self.gcode_header()

View File

@@ -124,6 +124,9 @@ class ToolLevelling(AppTool, CNCjob):
self.gcode_viewer_tab = None self.gcode_viewer_tab = None
# store the current selection shape status to be restored after manual adding test points
self.old_selection_state = self.app.defaults['global_selection_shape']
# ############################################################################################################# # #############################################################################################################
# ####################################### Signals ########################################################### # ####################################### Signals ###########################################################
# ############################################################################################################# # #############################################################################################################
@@ -520,7 +523,9 @@ class ToolLevelling(AppTool, CNCjob):
self.app.dec_format(new_x, self.app.decimals), self.app.dec_format(new_x, self.app.decimals),
self.app.dec_format(new_y, self.app.decimals) self.app.dec_format(new_y, self.app.decimals)
) )
points.append(formatted_point) # do not add the point if is already added
if formatted_point not in points:
points.append(formatted_point)
new_x += dx new_x += dx
new_y += dy new_y += dy
@@ -812,6 +817,11 @@ class ToolLevelling(AppTool, CNCjob):
# use the snapped position as reference # use the snapped position as reference
snapped_pos = self.app.geo_editor.snap(pos[0], pos[1]) snapped_pos = self.app.geo_editor.snap(pos[0], pos[1])
# do not add the point if is already added
old_points_coords = [(pt['point'].x, pt['point'].y) for pt in self.al_voronoi_geo_storage.values()]
if (snapped_pos[0], snapped_pos[1]) in old_points_coords:
return
probe_pt = Point(snapped_pos) probe_pt = Point(snapped_pos)
xxmin, yymin, xxmax, yymax = self.solid_geo.bounds xxmin, yymin, xxmax, yymax = self.solid_geo.bounds
@@ -930,6 +940,8 @@ class ToolLevelling(AppTool, CNCjob):
self.app.mp = self.app.plotcanvas.graph_event_connect('mouse_press', self.app.on_mouse_click_over_plot) self.app.mp = self.app.plotcanvas.graph_event_connect('mouse_press', self.app.on_mouse_click_over_plot)
self.app.mr = self.app.plotcanvas.graph_event_connect('mouse_release', self.app.mr = self.app.plotcanvas.graph_event_connect('mouse_release',
self.app.on_mouse_click_release_over_plot) self.app.on_mouse_click_release_over_plot)
# restore selection
self.app.defaults['global_selection_shape'] = self.old_selection_state
# Grid toggle # Grid toggle
if key == QtCore.Qt.Key_G or key == 'G': if key == QtCore.Qt.Key_G or key == 'G':