From 25bca44996ce03e55acbbff5edc7276013eef4c3 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 31 Oct 2021 02:28:30 +0300 Subject: [PATCH] - in Markers Plugin made sure that whenever new markers are added, the previous ones are first cleared so there is no accumulative action - in Markers Plugin added utility geometry for the manual mode --- CHANGELOG.md | 5 +++++ appPlugins/ToolMarkers.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb06e37..1231e6a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +31.10.2021 + +- in Markers Plugin made sure that whenever new markers are added, the previous ones are first cleared so there is no accumulative action +- in Markers Plugin added utility geometry for the manual mode + 30.10.2021 - small changes in the VisPyVisuals that should improve a bit the performance diff --git a/appPlugins/ToolMarkers.py b/appPlugins/ToolMarkers.py index f86b5d82..ae913bd1 100644 --- a/appPlugins/ToolMarkers.py +++ b/appPlugins/ToolMarkers.py @@ -67,6 +67,9 @@ class ToolMarkers(AppTool): self.handlers_connected = False + # storage for temporary shapes when adding manual markers + self.temp_shapes = self.app.move_tool.sel_shapes + def on_insert_type_changed(self, val): obj_type = 2 if val == 'geo' else 0 self.ui.obj_insert_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex())) @@ -286,6 +289,10 @@ class ToolMarkers(AppTool): def add_markers(self): self.app.call_source = "markers_tool" + + # cleanup previous possible markers + self.points.clear() + select_type = self.ui.mode_radio.get_value() if select_type == 'a': self.handle_automatic_placement() @@ -1016,6 +1023,8 @@ class ToolMarkers(AppTool): worker_task() def on_exit(self, corner_gerber_obj=None, cancelled=None, ok=True): + self.clear_utility_geometry() + # plot the object if corner_gerber_obj: try: @@ -1099,6 +1108,7 @@ class ToolMarkers(AppTool): if 'manual' not in self.points: self.points['manual'] = [] self.points['manual'].append(pos) + self.draw_utility_geometry(pos=pos) self.app.inform.emit( '%s: %d. %s' % @@ -1108,6 +1118,30 @@ class ToolMarkers(AppTool): elif event.button == right_button and self.app.event_is_dragging is False: self.handle_manual_placement() + def draw_utility_geometry(self, pos): + line_thickness = self.ui.thick_entry.get_value() + line_length = self.ui.l_entry.get_value() / 2.0 + + x = pos[0] - line_thickness / 2.0 + y = pos[1] + line_thickness / 2.0 + line_geo_hor = LineString([ + (x - line_length, y), (x + line_length, y) + ]) + line_geo_vert = LineString([ + (x, y + line_length), (x, y - line_length) + ]) + + outline = '#0000FFAF' + for shape in [line_geo_hor, line_geo_vert]: + self.temp_shapes.add(shape, color=outline, update=True, layer=0, tolerance=None) + + if self.app.is_legacy is True: + self.temp_shapes.redraw() + + def clear_utility_geometry(self): + self.temp_shapes.clear(update=True) + self.temp_shapes.redraw() + class MarkersUI: