diff --git a/README.md b/README.md index 740e381c..4978c7de 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ CAD program, and create G-Code for Isolation routing. 13.04.2019 - updating the German translation +- Gerber Editor: added ability to change on the fly the aperture after one of the tools: Add Pad or Add Pad Array is activated +- Gerber Editor: if a tool is cancelled via key shortcut ESCAPE, the selection is now deleted and any other action require a new selection 12.04.2019 diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index 8a0660f9..7ec59756 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -75,6 +75,21 @@ class FCPad(FCShapeTool): return None def util_shape(self, point): + # updating values here allows us to change the aperture on the fly, after the Tool has been started + self.storage_obj = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['solid_geometry'] + self.radius = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['size']) / 2 + self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"] + + # if those cause KeyError exception it means that the aperture type is not 'R'. Only 'R' type has those keys + try: + self.half_width = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['width']) / 2 + except KeyError: + pass + try: + self.half_height = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['height']) / 2 + except KeyError: + pass + if point[0] is None and point[1] is None: point_x = self.draw_app.x point_y = self.draw_app.y @@ -160,6 +175,11 @@ class FCPad(FCShapeTool): self.complete = True self.draw_app.app.inform.emit(_("[success] Done. Adding Pad completed.")) + def clean_up(self): + self.draw_app.selected = [] + self.draw_app.apertures_table.clearSelection() + self.draw_app.plot_all() + class FCPadArray(FCShapeTool): """ @@ -312,6 +332,21 @@ class FCPadArray(FCShapeTool): return DrawToolUtilityShape(LineString(temp_points)) def util_shape(self, point): + # updating values here allows us to change the aperture on the fly, after the Tool has been started + self.storage_obj = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['solid_geometry'] + self.radius = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['size']) / 2 + self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"] + + # if those cause KeyError exception it means that the aperture type is not 'R'. Only 'R' type has those keys + try: + self.half_width = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['width']) / 2 + except KeyError: + pass + try: + self.half_height = float(self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['height']) / 2 + except KeyError: + pass + if point[0] is None and point[1] is None: point_x = self.draw_app.x point_y = self.draw_app.y @@ -435,6 +470,11 @@ class FCPadArray(FCShapeTool): self.draw_app.array_frame.hide() return + def clean_up(self): + self.draw_app.selected = [] + self.draw_app.apertures_table.clearSelection() + self.draw_app.plot_all() + class FCRegion(FCShapeTool): """ @@ -481,6 +521,11 @@ class FCRegion(FCShapeTool): self.complete = True self.draw_app.app.inform.emit(_("[success] Done. Region completed.")) + def clean_up(self): + self.draw_app.selected = [] + self.draw_app.apertures_table.clearSelection() + self.draw_app.plot_all() + def on_key(self, key): if key == 'backspace': if len(self.points) > 0: @@ -501,6 +546,11 @@ class FCTrack(FCRegion): self.complete = True self.draw_app.app.inform.emit(_("[success] Done. Path completed.")) + def clean_up(self): + self.draw_app.selected = [] + self.draw_app.apertures_table.clearSelection() + self.draw_app.plot_all() + def utility_geometry(self, data=None): if len(self.points) > 0: temp_points = [x for x in self.points] @@ -659,6 +709,11 @@ class FCApertureMove(FCShapeTool): self.draw_app.build_ui() self.draw_app.app.inform.emit(_("[success] Done. Apertures Move completed.")) + def clean_up(self): + self.draw_app.selected = [] + self.draw_app.apertures_table.clearSelection() + self.draw_app.plot_all() + def utility_geometry(self, data=None): """ Temporary geometry on screen while using this tool. @@ -784,6 +839,9 @@ class FCApertureSelect(DrawTool): return "" + def clean_up(self): + self.draw_app.plot_all() + class FCTransform(FCShapeTool): def __init__(self, draw_app): diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 91a3693c..9ad13b1b 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2538,7 +2538,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.app.grb_editor.delete_utility_geometry() - self.app.grb_editor.plot_all() + # self.app.grb_editor.plot_all() + self.app.grb_editor.active_tool.clean_up() self.app.grb_editor.select_tool('select') return