- updated the 'single' isolation of Gerber polygons to remove the polygon if clicked on it and it is already in the list of single polygons to be isolated

This commit is contained in:
Marius Stanciu 2019-11-25 18:10:20 +02:00
parent b31d016b13
commit 9715fba5eb
2 changed files with 22 additions and 8 deletions

View File

@ -1081,14 +1081,24 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
clicked_poly = self.find_polygon(point=(curr_pos[0], curr_pos[1]))
if clicked_poly:
self.poly_list.append(clicked_poly)
self.app.inform.emit(
'%s: %d. %s' % (_("Added polygon"),
int(len(self.poly_list)),
_("Click to start adding next polygon or right click to start isolation."))
)
if clicked_poly not in self.poly_list:
self.poly_list.append(clicked_poly)
self.app.inform.emit(
'%s: %d. %s' % (_("Added polygon"),
int(len(self.poly_list)),
_("Click to add next polygon or right click to start isolation."))
)
else:
try:
self.poly_list.remove(clicked_poly)
except TypeError:
return
self.app.inform.emit(
'%s. %s' % (_("Removed polygon"),
_("Click to add/remove next polygon or right click to start isolation."))
)
else:
self.app.inform.emit(_("No polygon detected under click position. Try again."))
self.app.inform.emit(_("No polygon detected under click position."))
elif event.button == right_button and self.app.event_is_dragging is False:
# restore the Grid snapping if it was active before
@ -1103,7 +1113,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
self.app.mr = self.app.plotcanvas.graph_event_connect('mouse_release',
self.app.on_mouse_click_release_over_plot)
self.isolate(iso_type=self.iso_type, geometry=self.poly_list)
if self.poly_list:
self.isolate(iso_type=self.iso_type, geometry=self.poly_list)
else:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("List of single polygons is empty. Aborting."))
def isolate(self, iso_type=None, geometry=None, dia=None, passes=None, overlap=None, outname=None, combine=None,
milling_type=None, follow=None, plot=True):

View File

@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
- In Gerber isolation changed the UI
- in Gerber isolation added the option to selectively isolate only certain polygons
- made some optimizations in FlatCAMGerber.isolate() method
- updated the 'single' isolation of Gerber polygons to remove the polygon if clicked on it and it is already in the list of single polygons to be isolated
23.11.2019